source: rtems/cpukit/score/src/threadstart.c @ e6f7f81

4.115
Last change on this file since e6f7f81 was 1ccb64e1, checked in by Sebastian Huber <sebastian.huber@…>, on 06/06/13 at 13:28:41

scheduler: Add start idle thread operation

Add and use _Scheduler_Start_idle().

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief Initializes Thread and Executes it
5 *
6 * @ingroup ScoreThread
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-1999.
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.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/system.h>
23#include <rtems/score/apiext.h>
24#include <rtems/score/context.h>
25#include <rtems/score/interr.h>
26#include <rtems/score/isr.h>
27#include <rtems/score/object.h>
28#include <rtems/score/priority.h>
29#include <rtems/score/states.h>
30#include <rtems/score/sysstate.h>
31#include <rtems/score/thread.h>
32#include <rtems/score/threadq.h>
33#include <rtems/score/userextimpl.h>
34#include <rtems/score/wkspace.h>
35
36bool _Thread_Start(
37  Thread_Control            *the_thread,
38  Thread_Start_types         the_prototype,
39  void                      *entry_point,
40  void                      *pointer_argument,
41  Thread_Entry_numeric_type  numeric_argument,
42  Per_CPU_Control           *processor
43)
44{
45  if ( _States_Is_dormant( the_thread->current_state ) ) {
46
47    the_thread->Start.entry_point      = (Thread_Entry) entry_point;
48
49    the_thread->Start.prototype        = the_prototype;
50    the_thread->Start.pointer_argument = pointer_argument;
51    the_thread->Start.numeric_argument = numeric_argument;
52
53    _Thread_Load_environment( the_thread );
54
55    if ( processor == NULL ) {
56      _Thread_Ready( the_thread );
57    } else {
58      the_thread->current_state = STATES_READY;
59      _Scheduler_Start_idle( the_thread, processor );
60    }
61
62    _User_extensions_Thread_start( the_thread );
63
64    return true;
65  }
66
67  return false;
68}
Note: See TracBrowser for help on using the repository browser.