[PATCH] fix race condition in List_insert

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Aug 23 15:02:30 GMT 2021


Hi Aleksandr,


thanks for the patch.

On Aug 23 17:27, Aleksandr Malikov wrote:
> From: Aleksand Malikov <schn27@gmail.com>
> 
> Revert mx parameter and mutex lock while operating the list.
> Mutex was removed with 94d24160 informing that:
> 'Use InterlockedCompareExchangePointer to ensure race safeness
> without using a mutex.'
> 
> But it does not.
> 
> Calling pthread_mutex_init and pthread_mutex_destroy from two or
> more threads occasionally leads to hang in pthread_mutex_destroy.

Do you have a simple testcase in plain C, by any chance?

> To not change the behaviour of other cases where List_insert was called,
> List_insert_nolock is added.

LGTM.  Can you please provide a copyright waiver per
https://cygwin.com/contrib.html.  See the winsup/CONTRIBUTORS file.


Thanks,
Corinna


More information about the Cygwin-patches mailing list