Commit 1d4d9e79 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2236] Use PTHREAD_MUTEX_NORMAL fast mutexes by default

parent 7c4e02c1
......@@ -77,13 +77,18 @@ Mutex::Mutex() :
}
Deinitializer deinitializer(attributes);
// If debug mode is enabled in compilation, use the slower
// error-checking mutexes that detect deadlocks. Otherwise, use fast
// mutexes which don't. See the pthread_mutexattr_settype() POSIX
// documentation which describes these type attributes.
#ifdef ENABLE_DEBUG
// TODO: Distinguish if debug mode is enabled in compilation.
result = pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_ERRORCHECK);
#else
result = pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_NORMAL);
#endif // ENABLE_DEBUG
if (result != 0) {
isc_throw(isc::InvalidOperation, std::strerror(result));
}
#endif // ENABLE_DEBUG
auto_ptr<Impl> impl(new Impl);
result = pthread_mutex_init(&impl->mutex, &attributes);
......
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