4 * Author: Philip Kovacs
6 * Abstraction layer for timed threads
10 #define MINIMUM_INTERVAL_USECS 50000 /* 50000 microseconds = 50 ms = 0.05 sec */
12 /* opaque structure for clients */
13 typedef struct _timed_thread timed_thread;
15 /* create a timed thread */
16 timed_thread* timed_thread_create (void *(*start_routine)(void*), void *arg, unsigned int interval_ms);
18 /* destroy a timed thread */
19 void timed_thread_destroy (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread);
21 /* lock a timed thread for critical section activity */
22 int timed_thread_lock (timed_thread* p_timed_thread);
24 /* unlock a timed thread after critical section activity */
25 int timed_thread_unlock (timed_thread* p_timed_thread);
27 /* waits required interval for termination signal and returns 1 if got it, 0 otherwise */
28 int timed_thread_test (timed_thread* p_timed_thread);
30 /* exit a timed thread */
31 void timed_thread_exit (timed_thread* p_timed_thread);
33 /* register a timed thread for future destruction */
34 int timed_thread_register (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread);
36 /* destroy all registered timed threads */
37 void timed_thread_destroy_registered_threads (void);