Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible data race issues #180

Open
ryancaicse opened this issue Nov 19, 2021 · 1 comment
Open

Possible data race issues #180

ryancaicse opened this issue Nov 19, 2021 · 1 comment

Comments

@ryancaicse
Copy link

Hi, it seems the pointer variable self->locked should be guarded by the lock self->mtx.
However, it seems the self->locked is not protected at Line 489 due to the early lock releases at Line 488.

PaError PaUnixThread_NotifyParent( PaUnixThread* self )
{
PaError result = paNoError;
PA_UNLESS( self->parentWaiting, paInternalError );
if( !self->locked )
{
PA_ENSURE( PaUnixMutex_Lock( &self->mtx ) );
self->locked = 1;
}
self->parentWaiting = 0;
pthread_cond_signal( &self->cond );
PA_ENSURE( PaUnixMutex_Unlock( &self->mtx ) );
self->locked = 0;
error:
return result;
}

@ryancaicse
Copy link
Author

Similarly to

if( !self->locked )
{
PA_ENSURE( PaUnixMutex_Lock( &self->mtx ) );
self->locked = 1;
}
self->parentWaiting = 0;
pthread_cond_signal( &self->cond );
PA_ENSURE( PaUnixMutex_Unlock( &self->mtx ) );
self->locked = 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant