]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/event.h
2 * Copyright (C) 1996-2015 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.
12 #include "AsyncEngine.h"
13 #include "mem/forward.h"
17 /* event scheduling facilities - run a callback after a given time period. */
19 typedef void EVH(void *);
21 void eventAdd(const char *name
, EVH
* func
, void *arg
, double when
, int, bool cbdata
=true);
22 void eventAddIsh(const char *name
, EVH
* func
, void *arg
, double delta_ish
, int);
23 void eventDelete(EVH
* func
, void *arg
);
25 void eventFreeMemory(void);
26 int eventFind(EVH
*, void *);
30 MEMPROXY_CLASS(ev_entry
);
33 ev_entry(char const * name
, EVH
* func
, void *arg
, double when
, int weight
, bool cbdata
=true);
46 // manages time-based events
47 class EventScheduler
: public AsyncEngine
53 /* cancel a scheduled but not dispatched event */
54 void cancel(EVH
* func
, void * arg
);
55 /* clean up the used memory in the scheduler */
57 /* either EVENT_IDLE or milliseconds remaining until the next event */
58 int timeRemaining() const;
59 /* cache manager output for the event queue */
60 void dump(StoreEntry
*);
61 /* find a scheduled event */
62 bool find(EVH
* func
, void * arg
);
63 /* schedule a callback function to run in when seconds */
64 void schedule(const char *name
, EVH
* func
, void *arg
, double when
, int weight
, bool cbdata
=true);
65 int checkEvents(int timeout
);
66 static EventScheduler
*GetInstance();
69 static EventScheduler _instance
;
73 #endif /* SQUID_EVENT_H */