mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-14 06:49:35 -04:00
Make libevent_global_shutdown() idempotent
Two calls to libevent_global_shutdown on your exit path shouldn't result in a crash.
This commit is contained in:
parent
43d5389c80
commit
55e991b27c
1
event.c
1
event.c
@ -3168,6 +3168,7 @@ event_free_debug_globals_locks(void)
|
|||||||
#ifndef EVENT__DISABLE_DEBUG_MODE
|
#ifndef EVENT__DISABLE_DEBUG_MODE
|
||||||
if (event_debug_map_lock_ != NULL) {
|
if (event_debug_map_lock_ != NULL) {
|
||||||
EVTHREAD_FREE_LOCK(event_debug_map_lock_, 0);
|
EVTHREAD_FREE_LOCK(event_debug_map_lock_, 0);
|
||||||
|
event_debug_map_lock_ = NULL;
|
||||||
}
|
}
|
||||||
#endif /* EVENT__DISABLE_DEBUG_MODE */
|
#endif /* EVENT__DISABLE_DEBUG_MODE */
|
||||||
#endif /* EVENT__DISABLE_THREAD_SUPPORT */
|
#endif /* EVENT__DISABLE_THREAD_SUPPORT */
|
||||||
|
@ -124,6 +124,7 @@ evutil_free_secure_rng_globals_locks(void)
|
|||||||
#ifndef EVENT__DISABLE_THREAD_SUPPORT
|
#ifndef EVENT__DISABLE_THREAD_SUPPORT
|
||||||
if (arc4rand_lock != NULL) {
|
if (arc4rand_lock != NULL) {
|
||||||
EVTHREAD_FREE_LOCK(arc4rand_lock, 0);
|
EVTHREAD_FREE_LOCK(arc4rand_lock, 0);
|
||||||
|
arc4rand_lock = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
1
signal.c
1
signal.c
@ -455,6 +455,7 @@ evsig_free_globals_locks(void)
|
|||||||
#ifndef EVENT__DISABLE_THREAD_SUPPORT
|
#ifndef EVENT__DISABLE_THREAD_SUPPORT
|
||||||
if (evsig_base_lock != NULL) {
|
if (evsig_base_lock != NULL) {
|
||||||
EVTHREAD_FREE_LOCK(evsig_base_lock, 0);
|
EVTHREAD_FREE_LOCK(evsig_base_lock, 0);
|
||||||
|
evsig_base_lock = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user