]> git.sur5r.net Git - openldap/blob - include/ldap_rq.h
3344f902e1e9c83af972e26abda001490983098a
[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         void *private;
11 } re_t;
12
13 typedef struct runqueue_s {
14         LDAP_STAILQ_HEAD(l, re_s) task_list;
15         LDAP_STAILQ_HEAD(rl, re_s) run_list;
16         ldap_pvt_thread_mutex_t rq_mutex;
17 } runqueue_t;
18
19 LDAP_F( void )
20 ldap_pvt_runqueue_insert(
21         struct runqueue_s* rq,
22         time_t interval,
23         void *private
24 );
25
26 LDAP_F( void )
27 ldap_pvt_runqueue_remove(
28         struct runqueue_s* rq,
29         struct re_s* entry
30 );
31
32 LDAP_F( struct re_s* )
33 ldap_pvt_runqueue_next_sched(
34         struct runqueue_s* rq,
35         struct timeval** next_run
36 );
37
38 LDAP_F( void )
39 ldap_pvt_runqueue_runtask(
40         struct runqueue_s* rq,
41         struct re_s* entry
42 );
43
44 LDAP_F( void )
45 ldap_pvt_runqueue_stoptask(
46         struct runqueue_s* rq,
47         struct re_s* entry
48 );
49
50 LDAP_F( int )
51 ldap_pvt_runqueue_isrunning(
52         struct runqueue_s* rq,
53         struct re_s* entry
54 );
55
56 LDAP_F( void )
57 ldap_pvt_runqueue_resched(
58         struct runqueue_s* rq,
59         struct re_s* entry
60 );
61
62 #endif