RTEMS
taskwakeafter.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-1999.
10  * On-Line Applications Research Corporation (OAR).
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include <rtems/rtems/tasks.h>
22 #include <rtems/score/threadimpl.h>
24 
26  rtems_interval ticks
27 )
28 {
29  /*
30  * It is critical to obtain the executing thread after thread dispatching is
31  * disabled on SMP configurations.
32  */
33  Thread_Control *executing;
34  Per_CPU_Control *cpu_self;
35 
36  cpu_self = _Thread_Dispatch_disable();
37  executing = _Per_CPU_Get_executing( cpu_self );
38 
39  if ( ticks == 0 ) {
40  _Thread_Yield( executing );
41  } else {
44  _Thread_Add_timeout_ticks( executing, cpu_self, ticks );
45  }
46  _Thread_Dispatch_direct( cpu_self );
47  return RTEMS_SUCCESSFUL;
48 }
void _Thread_Yield(Thread_Control *executing)
Yields the currently executing thread.
Definition: threadyield.c:30
static __inline__ void _Thread_Add_timeout_ticks(Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Interval ticks)
Adds timeout ticks to the thread.
Definition: threadimpl.h:2405
void _Thread_Dispatch_direct(Per_CPU_Control *cpu_self)
Directly do a thread dispatch.
Inlined Routines in the Watchdog Handler.
This status code indicates successful completion.
Definition: status.h:86
static __inline__ void _Thread_Wait_flags_set(Thread_Control *the_thread, Thread_Wait_flags flags)
Sets the thread&#39;s wait flags.
Definition: threadimpl.h:2196
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
Per CPU Core Structure.
Definition: percpu.h:347
This header file defines the main parts of the Tasks Manager API.
#define STATES_WAITING_FOR_TIME
This macro corresponds to a task which is waiting for a relative or absolute timeout.
Definition: statesimpl.h:75
#define THREAD_WAIT_STATE_BLOCKED
Indicates that the thread completed the blocking operation.
Definition: threadimpl.h:2156
States_Control _Thread_Set_state(Thread_Control *the_thread, States_Control state)
Sets the specified thread state.
rtems_status_code rtems_task_wake_after(rtems_interval ticks)
%
Definition: taskwakeafter.c:25
Watchdog_Interval rtems_interval
This type is used to represent clock tick intervals.
Definition: types.h:90
static __inline__ Per_CPU_Control * _Thread_Dispatch_disable(void)
Disables thread dispatching.
Inlined Routines from the Thread Handler.