mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Fix the fix to Windows locking
For https://bugzilla.gnome.org/show_bug.cgi?id=737851 Unfortunately this change has introduced a problem which results in occasional hangs on Windows when running multi-threaded on a multi-core host. When locking the xmlRMutex the count field is increment inside the critical section but when unlocking the count field is decremented outside the critical section. The increment/decrement is not atomic so this can result in the count field being updated incorrectly. The solution is to change xmlRMutexUnlock to decrement the count field before leaving the critical section rather than after.
This commit is contained in:
committed by
Daniel Veillard
parent
9b987f8c98
commit
620a70615e
@@ -415,8 +415,8 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
|
||||
pthread_mutex_unlock(&tok->lock);
|
||||
#elif defined HAVE_WIN32_THREADS
|
||||
if (tok->count > 0) {
|
||||
LeaveCriticalSection(&tok->cs);
|
||||
tok->count--;
|
||||
LeaveCriticalSection(&tok->cs);
|
||||
}
|
||||
#elif defined HAVE_BEOS_THREADS
|
||||
if (tok->lock->tid == find_thread(NULL)) {
|
||||
|
||||
Reference in New Issue
Block a user