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

5
Last change on this file since ccd5434 was ccd5434, checked in by Sebastian Huber <sebastian.huber@…>, on 01/07/16 at 08:55:45

score: Introduce Thread_Entry_information

This avoids potential dead code in _Thread_Handler(). It gets rid of
the dangerous function pointer casts.

Update #2514.

  • Property mode set to 100644
File size: 1.2 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.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/score/threadimpl.h>
23#include <rtems/score/isrlevel.h>
24#include <rtems/score/schedulerimpl.h>
25#include <rtems/score/userextimpl.h>
26
27bool _Thread_Start(
28  Thread_Control                 *the_thread,
29  const Thread_Entry_information *entry,
30  Per_CPU_Control                *cpu
31)
32{
33  if ( _States_Is_dormant( the_thread->current_state ) ) {
34    the_thread->Start.Entry = *entry;
35    _Thread_Load_environment( the_thread );
36
37    if ( cpu == NULL ) {
38      _Thread_Ready( the_thread );
39    } else {
40      const Scheduler_Control *scheduler = _Scheduler_Get_by_CPU( cpu );
41
42      if ( scheduler != NULL ) {
43        the_thread->current_state = STATES_READY;
44        _Scheduler_Start_idle( scheduler, the_thread, cpu );
45      }
46    }
47
48    _User_extensions_Thread_start( the_thread );
49
50    return true;
51  }
52
53  return false;
54}
Note: See TracBrowser for help on using the repository browser.