4.104.114.84.95
Rev | Line | |
---|
[07d880f4] | 1 | /* |
---|
| 2 | * 3.4.1 Schedule Alarm, P1003.1b-1993, p. 79 |
---|
| 3 | * |
---|
[08311cc3] | 4 | * COPYRIGHT (c) 1989-1999. |
---|
[07d880f4] | 5 | * On-Line Applications Research Corporation (OAR). |
---|
| 6 | * |
---|
| 7 | * The license and distribution terms for this file may be |
---|
| 8 | * found in the file LICENSE in this distribution or at |
---|
| 9 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 10 | * |
---|
| 11 | * $Id$ |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | #include <pthread.h> |
---|
| 16 | #include <errno.h> |
---|
| 17 | |
---|
| 18 | #include <rtems/system.h> |
---|
| 19 | #include <rtems/posix/pthread.h> |
---|
| 20 | #include <rtems/posix/psignal.h> |
---|
| 21 | |
---|
| 22 | unsigned int alarm( |
---|
| 23 | unsigned int seconds |
---|
| 24 | ) |
---|
| 25 | { |
---|
| 26 | unsigned int remaining = 0; |
---|
| 27 | Watchdog_Control *the_timer; |
---|
| 28 | |
---|
| 29 | the_timer = &_POSIX_signals_Alarm_timer; |
---|
| 30 | |
---|
| 31 | switch ( _Watchdog_Remove( the_timer ) ) { |
---|
| 32 | case WATCHDOG_INACTIVE: |
---|
| 33 | case WATCHDOG_BEING_INSERTED: |
---|
| 34 | break; |
---|
| 35 | |
---|
| 36 | case WATCHDOG_ACTIVE: |
---|
| 37 | case WATCHDOG_REMOVE_IT: |
---|
| 38 | remaining = the_timer->initial - |
---|
| 39 | (the_timer->stop_time - the_timer->start_time); |
---|
| 40 | break; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | _Watchdog_Insert_seconds( the_timer, seconds ); |
---|
| 44 | |
---|
| 45 | return remaining; |
---|
| 46 | } |
---|
| 47 | |
---|
Note: See
TracBrowser
for help on using the repository browser.