source: rtems/cpukit/rtems/src/taskwakeafter.c @ 3be0c9a

4.115
Last change on this file since 3be0c9a was 3be0c9a, checked in by Sebastian Huber <sebastian.huber@…>, on 11/22/12 at 13:51:25

score: Add and use <rtems/score/userextimpl.h>

This file contains the parts of <rtems/score/userext.h> that are only
necessary for the RTEMS implementation.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  RTEMS Task Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 */
12
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/rtems/status.h>
19#include <rtems/rtems/support.h>
20#include <rtems/rtems/modes.h>
21#include <rtems/score/object.h>
22#include <rtems/score/scheduler.h>
23#include <rtems/score/stack.h>
24#include <rtems/score/states.h>
25#include <rtems/rtems/tasks.h>
26#include <rtems/score/thread.h>
27#include <rtems/score/threadq.h>
28#include <rtems/score/tod.h>
29#include <rtems/score/wkspace.h>
30#include <rtems/score/apiext.h>
31#include <rtems/score/sysstate.h>
32
33/*
34 *  rtems_task_wake_after
35 *
36 *  This directive suspends the requesting thread for the given amount
37 *  of ticks.
38 *
39 *  Input parameters:
40 *    ticks - number of ticks to wait
41 *
42 *  Output parameters:
43 *    RTEMS_SUCCESSFUL - always successful
44 */
45
46rtems_status_code rtems_task_wake_after(
47  rtems_interval ticks
48)
49{
50  _Thread_Disable_dispatch();
51    if ( ticks == 0 ) {
52      _Scheduler_Yield();
53    } else {
54      _Thread_Set_state( _Thread_Executing, STATES_DELAYING );
55      _Watchdog_Initialize(
56        &_Thread_Executing->Timer,
57        _Thread_Delay_ended,
58        _Thread_Executing->Object.id,
59        NULL
60      );
61      _Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
62    }
63  _Thread_Enable_dispatch();
64  return RTEMS_SUCCESSFUL;
65}
Note: See TracBrowser for help on using the repository browser.