]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/event.h
cd1cc6bfea75235edffb75c9137283a20a5065e3
2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_EVENT_H
10 #define SQUID_SRC_EVENT_H
12 #include "AsyncEngine.h"
13 #include "base/Packable.h"
14 #include "mem/forward.h"
16 /* event scheduling facilities - run a callback after a given time period. */
18 typedef void EVH(void *);
20 void eventAdd(const char *name
, EVH
* func
, void *arg
, double when
, int, bool cbdata
=true);
21 void eventAddIsh(const char *name
, EVH
* func
, void *arg
, double delta_ish
, int);
22 void eventDelete(EVH
* func
, void *arg
);
24 int eventFind(EVH
*, void *);
28 MEMPROXY_CLASS(ev_entry
);
31 ev_entry(char const * name
, EVH
* func
, void *arg
, double when
, int weight
, bool cbdata
=true);
44 // manages time-based events
45 class EventScheduler
: public AsyncEngine
50 ~EventScheduler() override
;
51 /* cancel a scheduled but not dispatched event */
52 void cancel(EVH
* func
, void * arg
);
53 /* clean up the used memory in the scheduler */
55 /* either EVENT_IDLE or milliseconds remaining until the next event */
56 int timeRemaining() const;
57 /* cache manager output for the event queue */
58 void dump(Packable
*);
59 /* find a scheduled event */
60 bool find(EVH
* func
, void * arg
);
61 /* schedule a callback function to run in when seconds */
62 void schedule(const char *name
, EVH
* func
, void *arg
, double when
, int weight
, bool cbdata
=true);
63 int checkEvents(int timeout
) override
;
64 static EventScheduler
*GetInstance();
67 static EventScheduler _instance
;
71 #endif /* SQUID_SRC_EVENT_H */