source: rtems/cpukit/rtems/src/taskinitusers.c @ bc175a1

Last change on this file since bc175a1 was bc175a1, checked in by Sebastian Huber <sebastian.huber@…>, on 11/19/20 at 14:30:17

Avoid INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL

Replace a runtime check with a compile time assertion. This makes the
INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL obsolete.

Update #4181.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicTasks Tasks
5 *
6 * @brief _RTEMS_tasks_Initialize_user_tasks_body
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2008.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifdef HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/rtems/tasksimpl.h>
23#include <rtems/score/assert.h>
24#include <rtems/score/threadimpl.h>
25#include <rtems/score/interr.h>
26
27void _RTEMS_tasks_Initialize_user_task( void )
28{
29  rtems_id                                id;
30  rtems_status_code                       return_value;
31  const rtems_initialization_tasks_table *user_task;
32
33  user_task = &_RTEMS_tasks_User_task_table;
34  return_value = rtems_task_create(
35    user_task->name,
36    user_task->initial_priority,
37    user_task->stack_size,
38    user_task->mode_set,
39    user_task->attribute_set,
40    &id
41  );
42  if ( !rtems_is_status_successful( return_value ) ) {
43    _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
44  }
45
46  return_value = rtems_task_start(
47    id,
48    user_task->entry_point,
49    user_task->argument
50  );
51  _Assert( rtems_is_status_successful( return_value ) );
52  (void) return_value;
53
54  _Assert( _Thread_Global_constructor == 0 );
55  _Thread_Global_constructor = id;
56}
Note: See TracBrowser for help on using the repository browser.