288 Commits

Author SHA1 Message Date
Nick Mathewson
2cbe115cbc Merge remote-tracking branch 'origin/patches-2.0' 2011-08-24 16:17:56 -04:00
Nick Mathewson
5b18f13048 Make rate limiting work with common_timeout logic 2011-08-24 16:17:05 -04:00
Nick Mathewson
3c63edd1f7 Make the priority inversion code use gettime(), not evutil_gettimeofday()
Since we're computing the time after each callback, we might as well
update the time cache (if we're using it) and use monotonic time (if
we've got that).
2011-08-17 22:04:04 -04:00
Nick Mathewson
a37a0c0e35 Make max_dispatch_interval able to apply only to low-priority events
Suggested by Alexander Drozdov
2011-08-17 22:03:57 -04:00
Alexander Drozdov
a9866aa8c1 Optimization in event_process_active(): ignore maxcb & endtime for highest priority events. 2011-08-17 22:03:57 -04:00
Nick Mathewson
9fa56bdf1c Make sure max_dispatch_callbacks is never negative
Suggested by Alexander Drozdov.
2011-08-17 22:03:57 -04:00
Nick Mathewson
fd4de1e7fe Add event_config function to limit time/callbacks between calls to dispatch 2011-08-17 22:03:57 -04:00
Mark Ellzey
67275433ec more event dbg updates 2011-08-11 16:53:01 -05:00
Mark Ellzey
4b7d298415 added timeout debug logs to include event ptr. 2011-08-11 13:25:24 -05:00
Mark Ellzey
3baab0dce9 Added usec debug in another area for debug 2011-08-11 12:06:54 -05:00
Mark Ellzey
ac43ce0450 Debug addition for printing usec on TIMEOUT debugging. 2011-08-11 11:56:26 -05:00
Nick Mathewson
e91d57f1f6 Merge remote-tracking branch 'github/21_split_functions'
Conflicts:
	event.c

The conflicts were with the 21_faster_timeout_adj branch, which
added a "reinsert" function that needed to get renamed to
"reinsert_timeout".  Also, some of the code that 21_split_functions
changes got removed by 21_faster_timeout_adj.
2011-08-08 16:20:53 -04:00
Nick Mathewson
24e2480520 Merge remote-tracking branch 'github/21_faster_timeout_adj' 2011-08-08 16:17:18 -04:00
Nick Mathewson
78fb99ceb2 Merge remote-tracking branch 'origin/patches-2.0' 2011-07-04 12:22:54 -04:00
Nick Mathewson
e7fe92709e Merge remote-tracking branch 'github/20_global_locks_init' into patches-2.0 2011-07-04 12:16:08 -04:00
Nick Mathewson
5099d858b1 Merge remote-tracking branch 'origin/patches-2.0' 2011-06-08 14:29:36 -04:00
Nick Mathewson
09fe97da3b Replace an assertion for event_base_free(NULL) with a check-and-warn
event_base_free(NULL) means "free the current event base".
Previously, it would assert if there was no 'current' base.  Now it
just warns and returns.

Reported by Gilad Benjamini
2011-06-08 14:24:45 -04:00
Nick Mathewson
e40bafe796 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	Makefile.am
	WIN32-Code/event2/event-config.h
	configure.in
	test/regress_ssl.c
2011-06-04 21:40:55 -04:00
Nick Mathewson
27ce38b618 Avoid a segfault when all methods are disabled or broken 2011-06-01 17:28:21 -04:00
Nick Mathewson
94b8e676f3 Allow base-notification functions to exist without setting an fd
The kqueue and evport backends can make good use of this.
2011-05-27 22:54:16 -04:00
Nick Mathewson
9f560bfa11 Use "_WIN32", not WIN32: it's standard and we don't need to fake it
This patch was automatically generated with perl.

Based on a patch by Peter Rosin.
2011-05-25 20:03:15 -04:00
Nick Mathewson
b683cae3cb Avoid race-condition when initializing global locks
Previously, we did stuff like
   if (!lock)
      EVTHREAD_ALLOC_LOCK(lock,0);
for the evsig base global lock, the arc4random lock, and the debug_map
lock.  But that's potentially racy!  Instead, we move the
responisiblity for global lock initialization to the functions where
we set up the lock callbacks.

(Rationale: We already require that you set up the locking callbacks
before you create any event_base, and that you do so exatly once.)
2011-04-22 14:06:33 -04:00
Nick Mathewson
2a83ecc849 In the 2.1 branch, let's try out lazy gettimeofday/clock_gettime comparison
For now, we'll only check for gettimeofday jumps once every 5 seconds.
Let's see how that works.

This reverts commit 5209fadfd07af3f3379ac607582c37933b33e044.
2011-03-07 23:01:54 -05:00
Nick Mathewson
4560b31bdf Merge remote branch 'origin/patches-2.0'
Conflicts:
	event-internal.h
2011-03-07 23:00:45 -05:00
Nick Mathewson
5209fadfd0 Disable lazy gettimeofday/clock_gettime comparison for now 2011-03-07 22:59:19 -05:00
Nick Mathewson
a459ef70ec Have event_base_gettimeofday_cached() always return wall-clock time
Based on code by Dave Hart
2011-03-03 15:48:26 -05:00
Nick Mathewson
d1cee3b1c7 Make event_count maintainance branchless at the expense of an extra shift. Needs benchmarking 2011-02-23 01:08:54 -05:00
Nick Mathewson
efc4dc503a possible optimization: split event_queue_insert/remove into separate functions. needs testing 2011-02-23 00:59:20 -05:00
Nick Mathewson
77a96fd901 Remove a needless base-notify when rescheduling the first timeout
We don't need to wake up the base when rescheduling the timeout that
will expire first: the base will already wake up, see that nothing is
ready, and go back to sleep.
2011-02-02 20:09:16 -05:00
Nick Mathewson
e47042fe26 Optimize the case where we reinsert an existing timeout 2011-02-02 20:08:00 -05:00
Kevin Bowling
0915ca0aa6 Include evconfig-private.h in internal files for great good. 2011-01-02 08:43:45 -07:00
Nick Mathewson
5beeec9d43 Correctly notify the main thread when activating an event from a subthread 2010-12-01 21:28:03 -05:00
Nick Mathewson
2e5a175bf3 Merge remote branch 'github/20_once_fixes' 2010-11-25 23:03:46 -05:00
Nick Mathewson
652024b6b1 Remove _event_initialized(); make event_initialized() a function(); make it consistent on windows and non-windows 2010-11-23 13:08:07 -05:00
Nick Mathewson
3ab578f848 Make sure the CLOEXEC flag is set on fds we open for base notification 2010-11-20 01:41:34 -05:00
Nick Mathewson
2d5e1bd0be Do not let EVLOOP_ONCE exit the loop until all deferred callbacks have run 2010-11-14 19:32:13 -05:00
Nick Mathewson
0617a81820 Make EVLOOP_ONCE ignore internal events
Merely getting an internal notification event from having an event
added or deleted from another thread should not cause
event_base_loop(base, EVLOOP_ONCE) to exit; previously, it did.
2010-11-14 19:25:54 -05:00
Nick Mathewson
b81217f78d Fix signal handler types for win64. 2010-10-27 17:37:32 -04:00
Nick Mathewson
19c71e7454 Fix som event_warns that should have been event_warnx 2010-10-27 10:36:08 -04:00
Nick Mathewson
e56ff65af1 Fix a minor syntax error that most compilers didn't care about 2010-10-26 11:01:58 -04:00
Nick Mathewson
7ad90f6a25 Merge branch '20_internal_prio' 2010-10-09 00:02:31 -04:00
Nick Mathewson
e1198997bc Make event.c debugging messages report fds 2010-09-21 22:44:39 -04:00
Nick Mathewson
90651b327a Put internal events at highest priority
(If we allow user events to starve internal events, then internal events
never actually happen, signals don't get acked, etc)
2010-09-17 00:24:50 -04:00
Nick Mathewson
720bd933c8 Warn when using the error-prone EV_SIGNAL interface in an error-prone way. Also, fix a couple of race conditions in signal.c
When using the signal.c signal backend, Libevent currently only allows
one event_base to actually receive signals at a time.  (This has been
the behavior since at least 1.4 and probably much earlier.)  Now, we
detect and warn if you're likely to be racing about which signal goes
to which thread.

We also add a lock to control modifications of the evsig_base field,
to avoid race conditions like those found by Jason Toffaletti.

Also, more comments.  Comments are good.
2010-09-15 01:12:01 -04:00
Christopher Davis
d98511c027 Make event_base_virtual_del() notify the base if needed 2010-09-09 14:37:44 -04:00
Christopher Davis
71b6801421 Don't decrement virutal event count twice in connect_complete. 2010-09-08 20:33:21 -07:00
Nick Mathewson
3658b1696d Merge remote branch 'chrisd/iocp-fixes4'
Conflicts:
	test/regress_thread.c
2010-09-08 14:12:12 -04:00
Nick Mathewson
4632b78e01 Minimize calls to base_notify implementation functions, thereby avoiding needless syscalls
The trick here is that if we already told the base to wake up, and it
hasn't woken up yet, we don't need to tell it to wake up again.  This
should help lots with inherently multithreaded code like IOCP.
2010-09-08 13:22:55 -04:00
Nick Mathewson
c7a06bfaee Avoid needlessly calling evthread_notify_base() when the loop is not running
Also make sure that we always hold the base lock when calling evthread_notify_base.
2010-09-08 13:09:40 -04:00
Christopher Davis
17a14f1af2 Only process up to MAX_DEFERRED deferred_cbs at a time.
If threads queue callbacks while event_process_deferred_callbacks is
running, the loop may spin long enough to significantly skew timers.
A unit test stressing this behavior is also in this commit.
2010-09-08 01:22:22 -07:00