diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-10-02 03:03:58 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-10-02 03:03:58 +0000 |
commit | ba8a17714ead9f36424c4ecc21c009735d1408e5 (patch) | |
tree | 96389ee29ee4018f46fc008193e2870ab91424a7 /test/regress.c | |
parent | d5b640fc16e9d9e1e709ec73eb938de9eeff3f2c (diff) | |
download | libevent-ba8a17714ead9f36424c4ecc21c009735d1408e5.tar.gz |
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
Diffstat (limited to 'test/regress.c')
-rw-r--r-- | test/regress.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/test/regress.c b/test/regress.c index 71e3776c..dce50d6f 100644 --- a/test/regress.c +++ b/test/regress.c @@ -487,20 +487,16 @@ test_combined(void) event_set(&w1.ev, pair[0], EV_WRITE, combined_write_cb, &w1); event_set(&r2.ev, pair[1], EV_READ, combined_read_cb, &r2); event_set(&w2.ev, pair[1], EV_WRITE, combined_write_cb, &w2); - if (event_add(&r1.ev, NULL) == -1) - exit(1); - if (event_add(&w1.ev, NULL)) - exit(1); - if (event_add(&r2.ev, NULL)) - exit(1); - if (event_add(&w2.ev, NULL)) - exit(1); - + tt_assert(event_add(&r1.ev, NULL) != -1); + tt_assert(!event_add(&w1.ev, NULL)); + tt_assert(!event_add(&r2.ev, NULL)); + tt_assert(!event_add(&w2.ev, NULL)); event_dispatch(); if (r1.nread == 8192 && r2.nread == 4096) test_ok = 1; +end: cleanup_test(); } |