event.c


Log

Author Commit Date CI Message
Nick Mathewson c9c4ec26 2009-10-21T05:36:27 Remove an EVBASE_RELEASE_LOCK that I missed. svn:r1452
Nick Mathewson 6b22e74a 2009-10-21T03:54:00 Add locking to event_base_loop. This is harder than it sounds, since we need to make sure to release the lock around the key call to the kernel (e.g., select, epoll_wait, kevent), AND we need to make sure that none of the fields that are used in that call are touched by anything that might be running concurrently in another thread. I managed to do this pretty well for everything but poll(). With poll, I needed to introduce a copy of the event_set structure. This patch also fixes a bug in win32.c where we called realloc() instead of mm_realloc(). svn:r1450
Nick Mathewson e3fd294a 2009-10-16T13:19:57 Spelling fixes in comments and strings. svn:r1445
Nick Mathewson ba8a1771 2009-10-02T03:03:58 Do not notify the main thread more than needed. Basically, we suppress the notification when an event is added or deleted and: - The event has no fd, or there is no change in whether we are reading/writing on the event's fd. - The event has no timeout, or adding the event did not make the earliest timeout become earlier. This should be a big efficiency win in applications with multiple threads and lots of timeouts. svn:r1439
Nick Mathewson d5b640fc 2009-10-01T15:29:08 Apply Ka-Hing Cheung's event_base_got_[break|exit] patch, with locking and whitespace fixes. svn:r1438
Nick Mathewson e3f89fa2 2009-09-11T18:21:57 Add a trivial race-fix from Chromium: do not try to re-detect whether we have a monotonic clock every time we make a new event_base. svn:r1427
Nick Mathewson f8b527e6 2009-07-28T05:09:06 Fix a dumb bug where we would allocate too little memory in event_get_supported_methods(). svn:r1383
Nick Mathewson b06b2649 2009-07-26T01:29:39 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
Nick Mathewson 59e8e959 2009-07-21T19:20:25 Add clarifying "static" to definitions of fns in event.c svn:r1372
Nick Mathewson 1fb2e818 2009-07-17T21:47:45 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
Nick Mathewson 69601fc2 2009-07-17T18:59:22 Update event_tv when time jumps backwards, so that we only note each jump once. Fix for 1939984 svn:r1353
Nick Mathewson 638116ca 2009-07-17T18:38:14 Add a check for event_add failure to evthread_make_base_notifiable() svn:r1348
Nick Mathewson 9fcd84d1 2009-07-14T19:19:45 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
Nick Mathewson 043515bc 2009-07-14T18:50:06 Stop using C++ style comments. svn:r1343
Nick Mathewson 6b4b77a2 2009-07-14T16:54:48 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
Nick Mathewson 59cd4936 2009-05-22T14:31:07 Do not free the event base lock until we are done removing all the events. Spotted by Joachim Bauch; fixes bug 2795402. svn:r1302
Nick Mathewson b4886ec8 2009-05-15T18:44:44 Trim 22 bytes from struct event on 32 bit platforms, more on 64-bit platforms. svn:r1292
Nick Mathewson 0fd70978 2009-05-05T01:09:03 Add an event_get_base() function to remove one more reason to include event_struct.h svn:r1271
Nick Mathewson 0e63e72a 2009-05-03T18:56:08 Nothing ever sets event_sigcb or event_gotsig any more: remove them. svn:r1270
Nick Mathewson ebf29455 2009-04-30T23:49:15 Compilation fixes for vc++ 2008 express. Not the end of them. svn:r1260
Nick Mathewson 37bc3466 2009-04-29T20:48:28 Catch attempts to event_base_once a persistent event. svn:r1250
Nick Mathewson 9ad45eef 2009-04-28T19:08:36 Patch from Eric Hopper: the test for EVENT_BASE_FLAG_IGNORE_ENV was inverted. svn:r1248
Nick Mathewson 2ebfd3ba 2009-04-28T19:08:17 Oops. We never actually defined event_config_set_flag(). svn:r1246
Nick Mathewson faa756c7 2009-04-23T21:34:37 Oops. event_config.flags was never initialized. Bugfix on 2.0.1-alpha. Found by Victor Goya. svn:r1236
Nick Mathewson 253151c5 2009-04-22T20:28:30 Detect and reject n_priorities less than 1. svn:r1222
Nick Mathewson 11ff74cf 2009-04-22T19:41:23 Add a flag to disable checking the EVENT_* environment variables. svn:r1220
Nick Mathewson d047b323 2009-04-17T17:22:32 Increment version to 2.0.1-alpha, and add a numeric version facility svn:r1193
Nick Mathewson 7fa8451d 2009-04-17T06:56:57 Add a configure flag to hardcode all of our mm functions. svn:r1186
Nick Mathewson fe95df15 2009-04-13T18:32:24 Fix typo in mm_free svn:r1173
Nick Mathewson 81616620 2009-04-10T14:58:15 A couple of tweaks for deferred callbacks. svn:r1151
Nick Mathewson 4868f4d2 2009-04-10T14:22:33 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
Nick Mathewson e3d82497 2009-04-10T14:21:53 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
Nick Mathewson f98385a4 2009-04-08T16:57:38 add a missing "static" to timeout_process. svn:r1145
Nick Mathewson ec35eb55 2009-02-12T22:19:54 Make threading functions global, like the mm_ functions. Use the libevent_pthread.la library in regress_pthread. svn:r1121
Nick Mathewson b85b710c 2009-01-27T22:34:36 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
Nick Mathewson 8889a770 2009-01-27T22:30:46 Replace all use of config.h with event-config.h. svn:r1064
Nick Mathewson 9993137c 2009-01-27T21:10:31 Remove all trailing whitespace in all the source files. svn:r1063
Niels Provos 1c927b7d 2009-01-27T16:29:48 fix memory leak whens etting up priorities; reported by Alexander Drozdov svn:r1061
Nick Mathewson f20902a2 2009-01-22T17:56:15 Remove evperiodic_assign and its related parts: its functionality is subsumed by EV_PERSIST timeouts. svn:r1040
Nick Mathewson 5e6f6dcd 2009-01-22T17:48:55 Use EV_PERSIST on notify event for efficiency and simplicity. svn:r1039
Niels Provos 56ea4687 2009-01-22T02:33:38 Change the semantics of timeouts in conjunction with EV_PERSIST; timeouts in that case will now repeat until deleted. svn:r1032
Niels Provos ed7e0e77 2009-01-19T23:40:11 bug fix and potentital race condition from Alexander Drozdov svn:r1025
Nick Mathewson a5901991 2009-01-19T20:37:24 Use eventfd for main-thread notification where available (i.e., linux). svn:r1023
Nick Mathewson c3e9fcf6 2009-01-19T20:22:47 Change the semantics of notify so we can implement it with eventfd or (given a different backend for win32) a windows Event. svn:r1022
Nick Mathewson 34d2fd06 2009-01-19T19:46:03 Debug and enable pipe notification svn:r1021
Nick Mathewson ec4cfa33 2009-01-19T01:34:14 Make event_break threadsafe; make notify-thread mechanism a little more generic; let it use pipes where they work. svn:r1019
Nick Mathewson 6bb2f842 2009-01-14T18:38:03 Add initializer functions for evmap types. svn:r1005
Nick Mathewson 169321c9 2009-01-13T20:26:37 Rename four internal headers to follow the -internal.h convention. svn:r1000
Nick Mathewson 55bcd7d2 2009-01-09T13:42:21 On win32, use a hashtable to map sockets to events rather than using an array. svn:r988
Niels Provos d776f846 2008-12-23T22:23:37 deprecate the usage of signal_{add,del,set} and name it evsignal_{add,del,set} instead; move the old definitions to compat svn:r973
Niels Provos 02b2b4d1 2008-12-23T16:37:01 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
Niels Provos 77867244 2008-12-19T21:02:36 memory leak: forgot to free the configuration object svn:r961
Niels Provos 808f00e1 2008-12-13T06:11:12 constify structs; from Andrei Nigmatulin svn:r959
Niels Provos 4fa4a562 2008-11-27T19:57:48 fix a typo in setting the global event base; reported by lance svn:r953
Niels Provos 4fe25cef 2008-11-27T19:27:33 Clear the timer cache when leaving the event loop; reported by Robin Haberkorn svn:r950
Niels Provos 31cfe526 2008-10-30T19:38:31 clear the timer cache on entering event loop; reported by Victor Chang svn:r944
Nick Mathewson c97ee898 2008-09-26T13:36:15 Fix: do not crash when asked to configure an impossible event_base svn:r942
Nick Mathewson de069b99 2008-09-05T16:29:56 On win32, errno is not the last socket error. Worse, WSAGetLastError() is not the last socket error sometimes (i.e., EWOULDBLOCK). Also, strerror() does not handle winsock errors. Therefore, event_err() and event_warn() are completely wrong for windows socket errors. Fix that. svn:r936
Niels Provos cca2f8fa 2008-07-25T01:29:54 make event_add not change any state if it fails; repoted by Ian Bell svn:r923
Niels Provos 3b24f4ee 2008-07-25T00:48:30 another fix; we also need to remove the signal event from the queue svn:r918
Niels Provos e67a5ea9 2008-07-25T00:19:15 fix a problem with epoll and event_reinit; reported by Alexander Drozdov svn:r917
Niels Provos f7e61870 2008-07-11T15:49:04 support multiple events listening on the same signal; make signals regular events that go on the same event queue svn:r901
Niels Provos 60e4c067 2008-06-24T22:41:43 add an event_debug statement for executing active events. svn:r865
Niels Provos 35b1236c 2008-06-24T15:29:41 change write to send for windows. svn:r859
Nick Mathewson 05965921 2008-05-31T14:37:31 Add new functions to access backends by their features and to query the features of a backend. svn:r842
Niels Provos 2deb3ce0 2008-05-29T01:39:43 simplify handling of environment variables for disabling backends; make event_get_supported_methods obey environment variables; this fixes make verify; problem reported by Scott Lamb. svn:r838
Niels Provos 8b66f1bd 2008-05-17T02:14:17 constify struct timeval * svn:r836
Niels Provos 134344b7 2008-05-16T01:55:40 Fix use of freed memory in event_reinit; pointed out by Peter Postma svn:r834
Nick Mathewson a68de252 2008-05-15T03:49:03 r19749@catbus: nickm | 2008-05-14 23:48:44 -0400 New function to dump inserted and active events. Also do not recv() on an int array. svn:r829
Niels Provos f9b4ee0a 2008-05-15T03:19:05 replace write/read/close with send/recv/EVUTIL_CLOSESOCKET svn:r828
Niels Provos 90ddd91f 2008-05-15T03:14:48 do not include sys/time.h on windows svn:r826
Nick Mathewson 03fafae0 2008-05-12T01:03:36 Make trunk event.c build happily on win32 under mingw. svn:r811
Nick Mathewson 8acb80b4 2008-05-08T22:51:39 r15551@tombo: nickm | 2008-05-08 14:49:20 -0400 Use _get_ convention for new accessor functions. (These are all new ones as of 2.0, I believe). svn:r799
Nick Mathewson 3d60bccc 2008-05-08T14:25:44 r19656@catbus: nickm | 2008-05-08 10:25:08 -0400 forward-port: Remove #include "misc.h"s. svn:r795
Nick Mathewson a26442c5 2008-05-08T14:06:33 r19649@catbus: nickm | 2008-05-08 10:00:14 -0400 Replace gettimeofday() usage with a new evutil_gettimeofday(). This removes all previous need for win32-code/misc.[ch] svn:r792
Niels Provos 3f56e364 2008-05-08T05:56:20 event_base_new_with_config() and related methods svn:r789
Niels Provos 3b2022ef 2008-05-08T05:33:15 provide an api for retrieving the supported event mechanisms svn:r788
Nick Mathewson d0c3644e 2008-05-05T15:45:30 r19599@catbus: nickm | 2008-05-05 11:26:18 -0400 Turn event_initialized() and friends into a function; add function equivalents for EVENT_FD and EVENT_SIGNAL. svn:r773
Nick Mathewson 40a44b36 2008-05-04T17:23:20 r19564@catbus: nickm | 2008-05-04 13:23:10 -0400 Fix compile with --enable-gcc-warnings and clock_gettime() svn:r766
Niels Provos 181007b9 2008-05-03T22:14:44 make event_assign void; it cannot return an error svn:r763
Niels Provos 1d30750b 2008-05-03T22:10:09 support for periodic timeouts svn:r762
Niels Provos 8c750eaf 2008-05-03T21:37:33 separate signal events from io events svn:r760
Niels Provos 45e6fb0d 2008-05-03T18:23:44 cache clock_gettime/gettimeofday values in base svn:r758
Nick Mathewson 5fbc7f0a 2008-05-02T16:28:25 r15439@tombo: nickm | 2008-05-02 12:28:08 -0400 use event_assign internall; switch uses of event_set to use event_assign instead. svn:r755
Nick Mathewson fe2e7307 2008-04-25T01:29:15 r15320@tombo: nickm | 2008-04-24 21:29:06 -0400 Yes, niels says this is safe. svn:r727
Nick Mathewson 94fb4d0a 2008-04-25T01:18:18 r15317@tombo: nickm | 2008-04-24 21:17:49 -0400 Add new functions to be more threadsafe (and structure-ignorant) than event_set. svn:r726
Nick Mathewson 49868b61 2008-04-25T01:18:08 r15316@tombo: nickm | 2008-04-24 20:58:36 -0400 Rename internal memory management functions from event_malloc() etc to mm_malloc() etc. svn:r725
Nick Mathewson 0ac73078 2008-04-16T20:01:51 r15193@tombo: nickm | 2008-04-16 16:00:35 -0400 Split event.h into several new headers in include/event2. event.h is now just a wrapper that includes all the subheaders. svn:r711
Niels Provos cb50f615 2008-03-11T05:26:30 rename lock create callback functions; as suggested by nick svn:r691
Niels Provos c182baca 2008-03-10T03:17:20 switch thread support so that locks get allocated as they are needed. svn:r690
Niels Provos 558de9b3 2008-03-02T21:18:33 Provide OpenSSL style support for multiple threads accessing the same event_base svn:r684
Niels Provos bb914ed9 2008-02-25T07:34:07 do not insert event into list when evsel->add fails svn:r660
Niels Provos 8ab61891 2008-02-16T06:09:39 event_base_get_method; from Springande Ulv svn:r635
Niels Provos 8c66d4e2 2008-01-26T07:29:57 remove pending timeouts on event_base_free svn:r627
Niels Provos 03589ccb 2007-12-24T22:49:30 rollback r594: restructuring to make event activation independent. changes are going to wait for api design svn:r612
Niels Provos 7aa845b7 2007-12-16T04:10:30 restructure the code to make event activation independent of regular event logic svn:r594
Niels Provos fbe24f43 2007-12-09T05:07:20 remove obsoleted recalc code svn:r581
Nick Mathewson 77861fa7 2007-12-06T19:20:24 r16931@catbus: nickm | 2007-12-06 14:19:58 -0500 Fix warnings in debug messages svn:r577
Nick Mathewson 3206bbca 2007-12-06T18:12:56 r15171@tombo: nickm | 2007-12-06 12:47:47 -0500 Use GCC attributes (where available) to verify printf type-correctness. Fix some bugs this turned up. svn:r573
Niels Provos ef085e84 2007-11-27T06:45:25 we need to pass the evbase to evsel->add svn:r558