Commit 42c638e0 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[master] Check for EDEADLK too when using Mutex::tryLock()

parent 8d321e3e
......@@ -123,7 +123,13 @@ bool
Mutex::tryLock() {
assert(impl_ != NULL);
const int result = pthread_mutex_trylock(&impl_->mutex);
if (result == EBUSY) {
// In the case of pthread_mutex_trylock(), if it is called on a
// locked mutex from the same thread, some platforms (such as fedora
// and debian) return EBUSY whereas others (such as centos 5) return
// EDEADLK. We return false and don't pass the lock attempt in both
// cases.
if (result == EBUSY || result == EDEADLK) {
return (false);
} else if (result != 0) {
isc_throw(isc::InvalidOperation, std::strerror(result));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment