openldap/include/ldap_rq.h

80 lines
1.6 KiB
C
Raw Normal View History

/* $OpenLDAP$ */
2003-05-25 11:31:21 +08:00
/*
* Copyright 2003 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License. A copy of this license is available at
* http://www.OpenLDAP.org/license.html or in file LICENSE in the
* top-level directory of the distribution.
*/
2003-05-08 06:29:26 +08:00
#ifdef LDAP_SYNCREPL
typedef struct re_s {
struct timeval next_sched;
struct timeval interval;
2003-05-08 06:29:26 +08:00
LDAP_STAILQ_ENTRY(re_s) tnext; /* it includes running */
LDAP_STAILQ_ENTRY(re_s) rnext;
2003-05-08 07:52:08 +08:00
ldap_pvt_thread_start_t *routine;
void *arg;
} re_t;
typedef struct runqueue_s {
2003-05-08 06:29:26 +08:00
LDAP_STAILQ_HEAD(l, re_s) task_list;
LDAP_STAILQ_HEAD(rl, re_s) run_list;
2003-05-08 06:29:26 +08:00
ldap_pvt_thread_mutex_t rq_mutex;
} runqueue_t;
2003-05-08 06:29:26 +08:00
LDAP_F( void )
ldap_pvt_runqueue_insert(
struct runqueue_s* rq,
time_t interval,
2003-05-08 07:52:08 +08:00
ldap_pvt_thread_start_t* routine,
void *arg
2003-05-08 06:29:26 +08:00
);
LDAP_F( void )
ldap_pvt_runqueue_remove(
struct runqueue_s* rq,
struct re_s* entry
);
LDAP_F( struct re_s* )
ldap_pvt_runqueue_next_sched(
struct runqueue_s* rq,
struct timeval** next_run
);
LDAP_F( void )
ldap_pvt_runqueue_runtask(
struct runqueue_s* rq,
struct re_s* entry
);
LDAP_F( void )
ldap_pvt_runqueue_stoptask(
struct runqueue_s* rq,
struct re_s* entry
);
LDAP_F( int )
ldap_pvt_runqueue_isrunning(
struct runqueue_s* rq,
struct re_s* entry
);
LDAP_F( void )
ldap_pvt_runqueue_resched(
struct runqueue_s* rq,
struct re_s* entry
);
LDAP_F( int )
ldap_pvt_runqueue_persistent_backload(
struct runqueue_s* rq
);
2003-05-08 06:29:26 +08:00
#endif