mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
test: fix bufferevent/bufferevent_pair_release_lock in debug mode
After this test had been fixed for freebsd the debug build was broken because we can't call evthread_set_lock_callbacks() when something already initialized, and we can't call event_base_free() (in kqueue case) when it is initialized, because of "held_by", but this only playing role during freeing lock profiler so reset lock callbacks there before and this will fix both. Fixes: 79f9ace4ae8a259a5cf1b4ff3869078b60ff16a1 ("test: fix bufferevent/bufferevent_pair_release_lock for freebsd") P.S. after this patch 'make verify' finishes without errors on freebsd.
This commit is contained in:
parent
79f9ace4ae
commit
3f749e93db
@ -276,14 +276,13 @@ static int trace_lock_unlock(unsigned mode, void *lock_)
|
||||
}
|
||||
static void lock_unlock_free_thread_cbs(void)
|
||||
{
|
||||
/** drop immutable flag */
|
||||
evthread_set_lock_callbacks(NULL);
|
||||
|
||||
event_base_free(NULL);
|
||||
|
||||
if (libevent_tests_running_in_debug_mode)
|
||||
libevent_global_shutdown();
|
||||
|
||||
/** drop immutable flag */
|
||||
evthread_set_lock_callbacks(NULL);
|
||||
/** avoid calling of event_global_setup_locks_() for new cbs */
|
||||
libevent_global_shutdown();
|
||||
/** drop immutable flag for non-debug ops (since called after shutdown) */
|
||||
@ -315,6 +314,9 @@ static int use_lock_unlock_profiler(void)
|
||||
}
|
||||
static void free_lock_unlock_profiler(struct basic_test_data *data)
|
||||
{
|
||||
/** fix "held_by" for kqueue */
|
||||
evthread_set_lock_callbacks(NULL);
|
||||
|
||||
lock_unlock_free_thread_cbs();
|
||||
free(lu_base.locks);
|
||||
data->base = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user