2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2017 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
19 #include <ldap_cdefs.h>
24 struct timeval next_sched;
25 struct timeval interval;
26 LDAP_STAILQ_ENTRY(re_s) tnext; /* it includes running */
27 LDAP_STAILQ_ENTRY(re_s) rnext;
28 ldap_pvt_thread_start_t *routine;
34 typedef struct runqueue_s {
35 LDAP_STAILQ_HEAD(l, re_s) task_list;
36 LDAP_STAILQ_HEAD(rl, re_s) run_list;
37 ldap_pvt_thread_mutex_t rq_mutex;
40 LDAP_F( struct re_s* )
41 ldap_pvt_runqueue_insert(
42 struct runqueue_s* rq,
44 ldap_pvt_thread_start_t* routine,
50 LDAP_F( struct re_s* )
51 ldap_pvt_runqueue_find(
52 struct runqueue_s* rq,
53 ldap_pvt_thread_start_t* routine,
58 ldap_pvt_runqueue_remove(
59 struct runqueue_s* rq,
63 LDAP_F( struct re_s* )
64 ldap_pvt_runqueue_next_sched(
65 struct runqueue_s* rq,
66 struct timeval* next_run
70 ldap_pvt_runqueue_runtask(
71 struct runqueue_s* rq,
76 ldap_pvt_runqueue_stoptask(
77 struct runqueue_s* rq,
82 ldap_pvt_runqueue_isrunning(
83 struct runqueue_s* rq,
88 ldap_pvt_runqueue_resched(
89 struct runqueue_s* rq,
95 ldap_pvt_runqueue_persistent_backload(