在 2019/4/26 下午4:11, Liu Hao 写道: > All other functions wait for `sema_b` with `waiters_count_lock_` locked. > The order of acquisition of these two things must happen in the same order > in all functions, otherwise deadlocks may happen. > > The obvious fix is to make wait functions wait for the semaphore after > having locked `waiters_count_lock_`. However, before the wait, the critical > seciton must be unlocked, otherwise all the other threads will be blocked > on signal/broadcast functions. The now consequent wait and signal operations > on the semaphore have no other effect and can be removed. > > From now on, waiting threads will update `waiters_count_` without attempting > to lock `sema_b`. If a wait function is called under the protection of the > external mutex, this was unnecessary; otherwise, scheduling behavior > might be > unpredictable, which nevertheless still conforms to POSIX. > > Signed-off-by: Liu Hao <[email protected]> > --- > mingw-w64-libraries/winpthreads/src/cond.c | 12 ------------ > 1 file changed, 12 deletions(-) > >
Unless there are failure reports I will push these two patches later today (~11 hours later). -- Best regards, LH_Mouse -- Best regards, LH_Mouse -- Best regards, ltpmouse
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
