File: delay.h

package info (click to toggle)
zeroconf 0.9-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 236 kB
  • ctags: 93
  • sloc: ansic: 1,331; sh: 86; makefile: 69
file content (38 lines) | stat: -rw-r--r-- 931 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * our delay API
 *
 * zeroconf requires us to have things outstanding on the network
 * and to wait until a certain amount of time has passed before
 * proceeding.
 *
 * This API tries to be somewhat sane to use but it has limitations,
 * like it needs to have SIGALARM handled specially. It can only
 * have a single delay outstanding at once. Delays are always against
 * observed real-time
 */

#ifndef DELAY_H
#define DELAY_H 1

#include <signal.h>

extern sig_atomic_t delay_timeout;
extern int delay_is_running;

void delay_setup_fixed (struct itimerval *delay, int delay_secs);

void delay_setup_random(struct itimerval *delay,
			int delay_min_secs,
			int delay_max_secs);

void delay_setup_immed (struct itimerval *delay);

void delay_run         (struct itimerval *delay);

int  delay_is_waiting  (void);

void delay_cancel      (void);

#define delay_wait()  { if (!delay_timeout) continue; }

#endif /* DELAY_H */