{
if(g_singleThreaded)
return;
- if((errno=pthread_mutex_lock(d_lock)))
+
+ int err;
+ if((err = pthread_mutex_lock(d_lock))) {
+ errno = err;
throw PDNSException("error acquiring lock: "+stringerror());
+ }
}
~Lock()
{
if(g_singleThreaded)
return;
- if((errno=pthread_rwlock_wrlock(d_lock))) {
+ int err;
+ if((err = pthread_rwlock_wrlock(d_lock))) {
+ errno = err;
throw PDNSException("error acquiring rwlock wrlock: "+stringerror());
}
}
}
d_havelock=false;
- if((errno=pthread_rwlock_trywrlock(d_lock)) && errno!=EBUSY)
+ int err;
+ if((err = pthread_rwlock_trywrlock(d_lock)) && err!=EBUSY) {
+ errno = err;
throw PDNSException("error acquiring rwlock tryrwlock: "+stringerror());
- d_havelock=(errno==0);
+ }
+ d_havelock=(err==0);
}
TryWriteLock(TryWriteLock&& rhs)
return;
}
- if((errno=pthread_rwlock_tryrdlock(d_lock)) && errno!=EBUSY)
+ int err;
+ if((err = pthread_rwlock_tryrdlock(d_lock)) && err!=EBUSY) {
+ errno = err;
throw PDNSException("error acquiring rwlock tryrdlock: "+stringerror());
- d_havelock=(errno==0);
+ }
+ d_havelock=(err==0);
}
TryReadLock(TryReadLock&& rhs)
{
if(g_singleThreaded)
return;
- if((errno=pthread_rwlock_rdlock(d_lock)))
+ int err;
+ if((err = pthread_rwlock_rdlock(d_lock))) {
+ errno = err;
throw PDNSException("error acquiring rwlock readlock: "+stringerror());
+ }
}
~ReadLock()
{