Add some assertions to catch potential threading issues in the libevent2 driver. See #419.