]> granicus.if.org Git - libevent/commitdiff
Fix bufferevent_async to use lock/unlock, not unlock/unlock.
authorNick Mathewson <nickm@torproject.org>
Wed, 6 May 2009 02:33:37 +0000 (02:33 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 6 May 2009 02:33:37 +0000 (02:33 +0000)
You do NOT want to know what windows does when you unlock a lock that is already unlocked.

svn:r1278

bufferevent_async.c

index 88f87576246a225a6abb3de67750ad1ea2eec9eb..6d5039791b488bc2b9854c07de318aa8bf601918 100644 (file)
@@ -180,7 +180,7 @@ be_async_inbuf_callback(struct evbuffer *buf,
        /* If we successfully read into the inbuf, or we drained data from
         * the inbuf and were not reading before, we may want to read now */
 
-       BEV_UNLOCK(bev);
+       BEV_LOCK(bev);
        if (cbinfo->n_added) {
                /* XXXX can't detect 0-length read completion */
                bev_async->read_in_progress = 0;
@@ -277,6 +277,8 @@ bufferevent_async_new(struct event_base *base,
 
        evbuffer_add_cb(bev->input, be_async_inbuf_callback, bev);
        evbuffer_add_cb(bev->output, be_async_outbuf_callback, bev);
+       evbuffer_defer_callbacks(bev->input, base);
+       evbuffer_defer_callbacks(bev->output, base);
 
        return bev;
 err: