threading: Support rwlock try_write_lock() on Windows

We explicitly avoided TryAcquireSRWLockExclusive() because of crashes. This
issue was caused by a MinGW-w64 bug (mingw-w64 fix 46f77afc). Using a newer
toolchain works fine.

While try_write_lock() obviously can fail, not supporting it is not really an
option, as some algorithms depend on occasionally successful calls. Certificate
caching in the certificate manager and the cred_set cache rely on successful
try_write_lock()ing.
This commit is contained in:
Martin Willi
2014-10-30 10:45:24 +01:00
parent 6a3f0467e4
commit 61e29aca0d
@@ -85,8 +85,6 @@ METHOD(rwlock_t, write_lock, void,
METHOD(rwlock_t, try_write_lock, bool,
private_rwlock_t *this)
{
/* TODO: causes random failures and segfaults. Bug? */
return FALSE;
return TryAcquireSRWLockExclusive(&this->srw);
}