2003-05-07 10:06:01 +08:00
|
|
|
/* $OpenLDAP$ */
|
2003-11-26 15:16:36 +08:00
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2009-01-22 08:40:04 +08:00
|
|
|
* Copyright 1998-2009 The OpenLDAP Foundation.
|
2003-05-25 11:31:21 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted only as authorized by the OpenLDAP
|
2003-11-26 15:16:36 +08:00
|
|
|
* Public License.
|
|
|
|
*
|
|
|
|
* A copy of this license is available in file LICENSE in the
|
|
|
|
* top-level directory of the distribution or, alternatively, at
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
2003-05-25 11:31:21 +08:00
|
|
|
*/
|
2003-05-07 10:06:01 +08:00
|
|
|
|
2003-05-31 13:01:49 +08:00
|
|
|
#ifndef LDAP_RQ_H
|
|
|
|
#define LDAP_RQ_H 1
|
|
|
|
|
|
|
|
#include <ldap_cdefs.h>
|
|
|
|
|
|
|
|
LDAP_BEGIN_DECL
|
2003-05-08 06:29:26 +08:00
|
|
|
|
2003-05-07 10:06:01 +08:00
|
|
|
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;
|
2005-04-23 08:27:57 +08:00
|
|
|
char *tname;
|
|
|
|
char *tspec;
|
2003-05-07 10:06:01 +08:00
|
|
|
} re_t;
|
|
|
|
|
|
|
|
typedef struct runqueue_s {
|
2003-05-08 06:29:26 +08:00
|
|
|
LDAP_STAILQ_HEAD(l, re_s) task_list;
|
2003-05-07 10:06:01 +08:00
|
|
|
LDAP_STAILQ_HEAD(rl, re_s) run_list;
|
2003-05-08 06:29:26 +08:00
|
|
|
ldap_pvt_thread_mutex_t rq_mutex;
|
2003-05-07 10:06:01 +08:00
|
|
|
} runqueue_t;
|
2003-05-08 06:29:26 +08:00
|
|
|
|
2005-04-22 22:37:59 +08:00
|
|
|
LDAP_F( struct re_s* )
|
2003-05-08 06:29:26 +08:00
|
|
|
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,
|
2005-04-23 08:27:57 +08:00
|
|
|
void *arg,
|
|
|
|
char *tname,
|
|
|
|
char *tspec
|
2003-05-08 06:29:26 +08:00
|
|
|
);
|
|
|
|
|
2005-04-19 22:40:30 +08:00
|
|
|
LDAP_F( struct re_s* )
|
|
|
|
ldap_pvt_runqueue_find(
|
|
|
|
struct runqueue_s* rq,
|
|
|
|
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,
|
2006-05-03 04:32:37 +08:00
|
|
|
struct timeval* next_run
|
2003-05-08 06:29:26 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
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,
|
2003-10-26 05:13:08 +08:00
|
|
|
struct re_s* entry,
|
|
|
|
int defer
|
2003-05-08 06:29:26 +08:00
|
|
|
);
|
|
|
|
|
2003-05-21 07:52:11 +08:00
|
|
|
LDAP_F( int )
|
|
|
|
ldap_pvt_runqueue_persistent_backload(
|
|
|
|
struct runqueue_s* rq
|
|
|
|
);
|
|
|
|
|
2003-05-31 13:01:49 +08:00
|
|
|
LDAP_END_DECL
|
|
|
|
|
2003-05-08 06:29:26 +08:00
|
|
|
#endif
|