source: trunk/minix/lib/timers/tmrs_clr.c@ 12

Last change on this file since 12 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 843 bytes
Line 
1#include "timers.h"
2
3/*===========================================================================*
4 * tmrs_clrtimer *
5 *===========================================================================*/
6clock_t tmrs_clrtimer(tmrs, tp, next_time)
7timer_t **tmrs; /* pointer to timers queue */
8timer_t *tp; /* timer to be removed */
9clock_t *next_time;
10{
11/* Deactivate a timer and remove it from the timers queue.
12 */
13 timer_t **atp;
14 struct proc *p;
15 clock_t prev_time;
16
17 if(*tmrs)
18 prev_time = (*tmrs)->tmr_exp_time;
19 else
20 prev_time = 0;
21
22 tp->tmr_exp_time = TMR_NEVER;
23
24 for (atp = tmrs; *atp != NULL; atp = &(*atp)->tmr_next) {
25 if (*atp == tp) {
26 *atp = tp->tmr_next;
27 break;
28 }
29 }
30
31 if(next_time) {
32 if(*tmrs)
33 *next_time = (*tmrs)->tmr_exp_time;
34 else
35 *next_time = 0;
36 }
37
38 return prev_time;
39}
40
Note: See TracBrowser for help on using the repository browser.