171 Commits

Author SHA1 Message Date
Nick Mathewson
f8b527e6a1 Fix a dumb bug where we would allocate too little memory in event_get_supported_methods().
svn:r1383
2009-07-28 05:09:06 +00:00
Nick Mathewson
b06b2649b4 Make "deferred callback queue" independent of event_base.
This way, we can more easily have an IOCP bufferevent implementation
that does not need an event_base at all.  Woot.

svn:r1381
2009-07-26 01:29:39 +00:00
Nick Mathewson
59e8e959dc Add clarifying "static" to definitions of fns in event.c
svn:r1372
2009-07-21 19:20:25 +00:00
Nick Mathewson
1fb2e818a6 Use a uniform strategy when a function is not working: do not expose
it.

Rather than failing at runtime, it is better to fail at compile or
link time.

svn:r1363
2009-07-17 21:47:45 +00:00
Nick Mathewson
69601fc2f6 Update event_tv when time jumps backwards, so that we only note each jump once. Fix for 1939984
svn:r1353
2009-07-17 18:59:22 +00:00
Nick Mathewson
638116cacd Add a check for event_add failure to evthread_make_base_notifiable()
svn:r1348
2009-07-17 18:38:14 +00:00
Nick Mathewson
9fcd84d196 Include disabled methods in event_get_supported_methods() output.
Previously, events that were disabled using EVENT_NO* were left out of
event_get_supported_methods().  This was wrong, broke unit tests
(under some circumstances) and left the user with no good way to tell
which methods were actually compiled in.

Fixes bug 2821015.

svn:r1344
2009-07-14 19:19:45 +00:00
Nick Mathewson
043515bc52 Stop using C++ style comments.
svn:r1343
2009-07-14 18:50:06 +00:00
Nick Mathewson
6b4b77a265 Make event_del(E) block while E is running in another thread.
This gives you the property that once you have called event_del(E),
you know that E is no longer running or pending or active at all, and
so it is safe to delete the resource used by E's callback.

svn:r1341
2009-07-14 16:54:48 +00:00
Nick Mathewson
59cd49363c Do not free the event base lock until we are done removing all the events. Spotted by Joachim Bauch; fixes bug 2795402.
svn:r1302
2009-05-22 14:31:07 +00:00
Nick Mathewson
b4886ec80d Trim 22 bytes from struct event on 32 bit platforms, more on 64-bit platforms.
svn:r1292
2009-05-15 18:44:44 +00:00
Nick Mathewson
0fd70978c8 Add an event_get_base() function to remove one more reason to include event_struct.h
svn:r1271
2009-05-05 01:09:03 +00:00
Nick Mathewson
0e63e72a05 Nothing ever sets event_sigcb or event_gotsig any more: remove them.
svn:r1270
2009-05-03 18:56:08 +00:00
Nick Mathewson
ebf294559e Compilation fixes for vc++ 2008 express. Not the end of them.
svn:r1260
2009-04-30 23:49:15 +00:00
Nick Mathewson
37bc34662b Catch attempts to event_base_once a persistent event.
svn:r1250
2009-04-29 20:48:28 +00:00
Nick Mathewson
9ad45eef75 Patch from Eric Hopper: the test for EVENT_BASE_FLAG_IGNORE_ENV was inverted.
svn:r1248
2009-04-28 19:08:36 +00:00
Nick Mathewson
2ebfd3bafd Oops. We never actually defined event_config_set_flag().
svn:r1246
2009-04-28 19:08:17 +00:00
Nick Mathewson
faa756c7c1 Oops. event_config.flags was never initialized. Bugfix on 2.0.1-alpha. Found by Victor Goya.
svn:r1236
2009-04-23 21:34:37 +00:00
Nick Mathewson
253151c54c Detect and reject n_priorities less than 1.
svn:r1222
2009-04-22 20:28:30 +00:00
Nick Mathewson
11ff74cf64 Add a flag to disable checking the EVENT_* environment variables.
svn:r1220
2009-04-22 19:41:23 +00:00
Nick Mathewson
d047b323bd Increment version to 2.0.1-alpha, and add a numeric version facility
svn:r1193
2009-04-17 17:22:32 +00:00
Nick Mathewson
7fa8451d7e Add a configure flag to hardcode all of our mm functions.
svn:r1186
2009-04-17 06:56:57 +00:00
Nick Mathewson
fe95df15d3 Fix typo in mm_free
svn:r1173
2009-04-13 18:32:24 +00:00
Nick Mathewson
8161662007 A couple of tweaks for deferred callbacks.
svn:r1151
2009-04-10 14:58:15 +00:00
Nick Mathewson
4868f4d217 Initial support for a lightweight 'deferred callbacks'.
A 'deferred callback' is just a function that we've queued in the
event base.  This ability is needed for some mt stuff, and for complex
callback chains.  For internal use only.

svn:r1150
2009-04-10 14:22:33 +00:00
Nick Mathewson
e3d82497c9 Don't allow internal events to starve lower-priority events.
This is exceptionally important with multithreaded stuff, where we use
an event to notify the base that other events have been made active.
If the activated events have a prioirty number greater than that of the
notification event, it will starve them, and that's no good.

svn:r1149
2009-04-10 14:21:53 +00:00
Nick Mathewson
f98385a407 add a missing "static" to timeout_process.
svn:r1145
2009-04-08 16:57:38 +00:00
Nick Mathewson
ec35eb5520 Make threading functions global, like the mm_ functions. Use the libevent_pthread.la library in regress_pthread.
svn:r1121
2009-02-12 22:19:54 +00:00
Nick Mathewson
b85b710cf5 Update copyright statements to reflect the facts that:
a) this is 2009
b) niels and nick have been comaintainers for a while
c) saying "all rights reserved" when you then go on to explicitly
   disclaim some rights is sheer cargo-cultism.

svn:r1065
2009-01-27 22:34:36 +00:00
Nick Mathewson
8889a77039 Replace all use of config.h with event-config.h.
svn:r1064
2009-01-27 22:30:46 +00:00
Nick Mathewson
9993137cbb Remove all trailing whitespace in all the source files.
svn:r1063
2009-01-27 21:10:31 +00:00
Niels Provos
1c927b7d2f fix memory leak whens etting up priorities; reported by Alexander Drozdov
svn:r1061
2009-01-27 16:29:48 +00:00
Nick Mathewson
f20902a290 Remove evperiodic_assign and its related parts: its functionality is subsumed by EV_PERSIST timeouts.
svn:r1040
2009-01-22 17:56:15 +00:00
Nick Mathewson
5e6f6dcd1b Use EV_PERSIST on notify event for efficiency and simplicity.
svn:r1039
2009-01-22 17:48:55 +00:00
Niels Provos
56ea4687a5 Change the semantics of timeouts in conjunction with EV_PERSIST; timeouts in that case will now repeat until deleted.
svn:r1032
2009-01-22 02:33:38 +00:00
Niels Provos
ed7e0e77ed bug fix and potentital race condition from Alexander Drozdov
svn:r1025
2009-01-19 23:40:11 +00:00
Nick Mathewson
a5901991c7 Use eventfd for main-thread notification where available (i.e., linux).
svn:r1023
2009-01-19 20:37:24 +00:00
Nick Mathewson
c3e9fcf672 Change the semantics of notify so we can implement it with eventfd or (given a different backend for win32) a windows Event.
svn:r1022
2009-01-19 20:22:47 +00:00
Nick Mathewson
34d2fd0634 Debug and enable pipe notification
svn:r1021
2009-01-19 19:46:03 +00:00
Nick Mathewson
ec4cfa33c9 Make event_break threadsafe; make notify-thread mechanism a little more generic; let it use pipes where they work.
svn:r1019
2009-01-19 01:34:14 +00:00
Nick Mathewson
6bb2f84216 Add initializer functions for evmap types.
svn:r1005
2009-01-14 18:38:03 +00:00
Nick Mathewson
169321c9e6 Rename four internal headers to follow the -internal.h convention.
svn:r1000
2009-01-13 20:26:37 +00:00
Nick Mathewson
55bcd7d2f0 On win32, use a hashtable to map sockets to events rather than using an array.
svn:r988
2009-01-09 13:42:21 +00:00
Niels Provos
d776f8462b deprecate the usage of signal_{add,del,set} and name it evsignal_{add,del,set} instead; move the old definitions to compat
svn:r973
2008-12-23 22:23:37 +00:00
Niels Provos
02b2b4d1be Restructure the event backends so that they do not need to keep track of events themselves, as a side effect multiple events can use the same fd or signal.
svn:r972
2008-12-23 16:37:01 +00:00
Niels Provos
77867244a9 memory leak: forgot to free the configuration object
svn:r961
2008-12-19 21:02:36 +00:00
Niels Provos
808f00e1a1 constify structs; from Andrei Nigmatulin
svn:r959
2008-12-13 06:11:12 +00:00
Niels Provos
4fa4a56253 fix a typo in setting the global event base; reported by lance
svn:r953
2008-11-27 19:57:48 +00:00
Niels Provos
4fe25cefb5 Clear the timer cache when leaving the event loop; reported by Robin Haberkorn
svn:r950
2008-11-27 19:27:33 +00:00
Niels Provos
31cfe52662 clear the timer cache on entering event loop; reported by Victor Chang
svn:r944
2008-10-30 19:38:31 +00:00