On 13.03.2017 22:33, Daniel Lehman wrote:
Not sure if its suitable here, but please note that Wines threadpool implementation also supports waiting on more than 64 objects (using similar tricks). If possible, it would be better to avoid the second implementation.
Not sure what you mean. Are you talking about timerqueue_thread_proc?
I'm talking about CreateThreadpoolWait/SetThreadpoolWait or the corresponding ntdll functions TpAllocWait/TpSetWait. Each wait handle would have to be added separately, but there is no limitation for the number of handles. Also see dlls/ntdll/tests/threadpool.c:test_tp_multi_wait for an example how it can be used.
Nevertheless, after more careful reviewing in your patch, it looks like handles are never really exposed to the application, is that correct? I'm not really sure why you need a separate thread then. Why does event_set for example not wake up the the pending waits directly? You have to be careful when locking multiple critical sections, but I do not see any reason why it shouldn't be possible.
Best regards, Sebastian