2
0
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:
Bob Halley
1998-11-11 19:03:08 +00:00
parent 903c1c35fc
commit f671a5c51c
2 changed files with 8 additions and 0 deletions

View File

@@ -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)

View File

@@ -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)