mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
easy_lock: add a pthread_mutex_t fallback
This allows to keep the init threadsafe with gcc < 4.9.0 (no C11 atomics). Closes https://github.com/curl/curl/pull/12090
This commit is contained in:
parent
2e283c69e0
commit
5adb6000ff
1 changed files with 9 additions and 0 deletions
|
|
@ -93,6 +93,15 @@ static inline void curl_simple_lock_unlock(curl_simple_lock *lock)
|
|||
atomic_store_explicit(lock, false, memory_order_release);
|
||||
}
|
||||
|
||||
#elif defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define curl_simple_lock pthread_mutex_t
|
||||
#define CURL_SIMPLE_LOCK_INIT PTHREAD_MUTEX_INITIALIZER
|
||||
#define curl_simple_lock_lock(m) pthread_mutex_lock(m)
|
||||
#define curl_simple_lock_unlock(m) pthread_mutex_unlock(m)
|
||||
|
||||
#else
|
||||
|
||||
#undef GLOBAL_INIT_IS_THREADSAFE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue