I have attached a minimal patch that fixes the deadlock issue. The principle change to avoid deadlock, is to not wait whilst holding the "waiters count lock". Because of this change to the locking, there is an additional case required in the "signal" and "broadcast" functions which handles when the "waiters count" goes to zero.
I'm away on holiday (vacation), so will probably not have time to sort out the other changes that were included in my original patch which are probably still worth while, particularly the removal of the locking from the "sema" functions. Cheers, Andrew On Mon, 8 Apr 2019 at 23:36, Liu Hao <[email protected]> wrote: > 在 2019/4/8 21:16, Andrew Ng 写道: > > Do you want me to split up the patch? > > > > Yes. At least you should have proposed a minimum patch that explains why > the old code was broken and how you fixed it. Style adjustments can > follow provided they have clearly no impact on behavior of existent code. > > > I reformatted the code to a consistent layout to improve readability > > whilst I was trying to figure out how it worked. The original code had a > > variety of styles. Is there a "preferred" style? I noticed that other > > source have different styles. > > I am afraid not. Our repository has been developing for many years with > contributions from many people; it is almost impossible to have all > people agree on a specific coding style. When people start to agree on > such divergence, the crucial thing is to make you ideas clear and easy > to be understood. In addition, a single commit altering more code is > more subject to likelihood of conflicts, should it be backported. > > > > > Does the removal of locking from the sema routines count as a separate > > change? > > > > If it is paramount for the fix (i.e. the code will break without it), > then no. If it is superfluous but harmless, then yes. > > > Are there any other rules or guidelines I need to be aware of? > > > > > > Again, please keep the set of changes minimal and clear for further > discussion. > > > -- > Best regards, > LH_Mouse > _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
