ntdll: Use condition variable for RtlQueueWorkItem implementation (try 2)

Sebastian Lackner sebastian at fds-team.de
Tue Mar 11 10:54:04 CDT 2014


This patch replaces the current implementation of RtlQueueWorkItem with a
better one using condition variables. See mail #1 for some more details.

Changes in try 2:

* removed if-branch which accesses num_workers without locking the critical
section, since this code is most likely not executed very often, and looks
confusing at first sight ;-)

* Add an additional variable "num_items_processed", which is used to detect
if other threads have processed the item in the meantime. We don't
explicitly check if the specific item was processed (but just that there
was some activity) and assume that the worker threads never crash (but
there also wasn't any check before, so I think its save to assume this). It
also doesn't matter if the variable overflows since we only compare for
equality. This way we can prevent a duplicate free even in the unlikely
case when the thread pauses for over 30 seconds.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140311/fcf31735/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ntdll-Use-condition-variable-for-RtlQueueWorkItem-im.patch
Type: text/x-patch
Size: 7645 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140311/fcf31735/attachment.bin>


More information about the wine-patches mailing list