mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
add isc_mutex_trylock()
This commit is contained in:
@@ -16,9 +16,15 @@ typedef pthread_mutex_t isc_mutex_t;
|
||||
#define isc_mutex_lock(mp) \
|
||||
((pthread_mutex_lock((mp)) == 0) ? \
|
||||
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
|
||||
#define isc_mutex_lock(mp) \
|
||||
((pthread_mutex_lock((mp)) == 0) ? \
|
||||
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
|
||||
#define isc_mutex_unlock(mp) \
|
||||
((pthread_mutex_unlock((mp)) == 0) ? \
|
||||
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
|
||||
#define isc_mutex_trylock(mp) \
|
||||
((pthread_mutex_trylock((mp)) == 0 ? \
|
||||
ISC_R_SUCCESS : ISC_R_LOCKBUSY)
|
||||
#define isc_mutex_destroy(mp) \
|
||||
((pthread_mutex_destroy((mp)) == 0) ? \
|
||||
ISC_R_SUCCESS : ISC_R_UNEXPECTED)
|
||||
|
@@ -14,6 +14,8 @@ typedef CRITICAL_SECTION isc_mutex_t;
|
||||
(EnterCriticalSection((mp)), ISC_R_SUCCESS)
|
||||
#define isc_mutex_unlock(mp) \
|
||||
(LeaveCriticalSection((mp)), ISC_R_SUCCESS)
|
||||
#define isc_mutex_trylock(mp) \
|
||||
(TryEnterCriticalSection((mp)) ? ISC_R_SUCCESS : ISC_R_LOCKBUSY)
|
||||
#define isc_mutex_destroy(mp) \
|
||||
(DeleteCriticalSection((mp)), ISC_R_SUCCESS)
|
||||
|
||||
|
Reference in New Issue
Block a user