]> git.sur5r.net Git - openldap/blob - include/ldap_rq.h
runqueue restructuring
[openldap] / include / ldap_rq.h
1 /* $OpenLDAP$ */
2
3 #ifdef LDAP_SYNCREPL
4
5 typedef struct re_s {
6         struct timeval next_sched;
7         struct timeval interval;
8         LDAP_STAILQ_ENTRY(re_s) tnext; /* it includes running */
9         LDAP_STAILQ_ENTRY(re_s) rnext;
10         ldap_pvt_thread_start_t *routine;
11         void *arg;
12 } re_t;
13
14 typedef struct runqueue_s {
15         LDAP_STAILQ_HEAD(l, re_s) task_list;
16         LDAP_STAILQ_HEAD(rl, re_s) run_list;
17         ldap_pvt_thread_mutex_t rq_mutex;
18 } runqueue_t;
19
20 LDAP_F( void )
21 ldap_pvt_runqueue_insert(
22         struct runqueue_s* rq,
23         time_t interval,
24         ldap_pvt_thread_start_t* routine,
25         void *arg
26 );
27
28 LDAP_F( void )
29 ldap_pvt_runqueue_remove(
30         struct runqueue_s* rq,
31         struct re_s* entry
32 );
33
34 LDAP_F( struct re_s* )
35 ldap_pvt_runqueue_next_sched(
36         struct runqueue_s* rq,
37         struct timeval** next_run
38 );
39
40 LDAP_F( void )
41 ldap_pvt_runqueue_runtask(
42         struct runqueue_s* rq,
43         struct re_s* entry
44 );
45
46 LDAP_F( void )
47 ldap_pvt_runqueue_stoptask(
48         struct runqueue_s* rq,
49         struct re_s* entry
50 );
51
52 LDAP_F( int )
53 ldap_pvt_runqueue_isrunning(
54         struct runqueue_s* rq,
55         struct re_s* entry
56 );
57
58 LDAP_F( void )
59 ldap_pvt_runqueue_resched(
60         struct runqueue_s* rq,
61         struct re_s* entry
62 );
63
64 #endif