Skip to content

Thread Sanitizer flags __PHYSFS_platformGrabMutex as having a data race #87

Description

@nicebyte

It appears that TSan gets tripped up by reading/writing the owner of the mutex in the function below:

int __PHYSFS_platformGrabMutex(void *mutex)
{
    PthreadMutex *m = (PthreadMutex *) mutex;
    pthread_t tid = pthread_self();
    if (m->owner != tid)
    {
        if (pthread_mutex_lock(&m->mutex) != 0)
            return 0;
        m->owner = tid;
    } /* if */

    m->count++;
    return 1;
} /* __PHYSFS_platformGrabMutex */

I've added this function to my suppressions file, but would be nice to do something about it? Technically, an atomic load/store is warranted here i believe.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions