Skip to content

Instantly share code, notes, and snippets.

@stanaka
Created August 14, 2010 15:59
Show Gist options
  • Save stanaka/524427 to your computer and use it in GitHub Desktop.
Save stanaka/524427 to your computer and use it in GitHub Desktop.
diff -ur libevent-1.3b.original/event.c libevent-1.3b/event.c
--- libevent-1.3b.original/event.c 2007-02-16 09:49:06.000000000 +0900
+++ libevent-1.3b/event.c 2010-08-15 00:58:14.000000000 +0900
@@ -790,13 +790,13 @@
docount = 0;
if (docount)
- base->event_count--;
+ __sync_sub_and_fetch(&(base->event_count), 1);
ev->ev_flags &= ~queue;
switch (queue) {
case EVLIST_ACTIVE:
if (docount)
- base->event_count_active--;
+ __sync_sub_and_fetch(&(base->event_count_active), 1);
TAILQ_REMOVE(base->activequeues[ev->ev_pri],
ev, ev_active_next);
break;
@@ -832,13 +832,13 @@
docount = 0;
if (docount)
- base->event_count++;
+ __sync_add_and_fetch(&(base->event_count), 1);
ev->ev_flags |= queue;
switch (queue) {
case EVLIST_ACTIVE:
if (docount)
- base->event_count_active++;
+ __sync_add_and_fetch(&(base->event_count_active), 1);
TAILQ_INSERT_TAIL(base->activequeues[ev->ev_pri],
ev,ev_active_next);
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment