Hacker News new | past | comments | ask | show | jobs | submit login

It is unsafe. But it would be safe if these two lines were swapped:

    count++;
    pthread_mutex_lock(&m);
since the reader already holds the mutex while reading `count`.



Do a PR or equivalent?


Friendly reminder that not everyone is in a position where they can create pull requests against random projects: they might not have time, or clearance from their company's legal department, or…


???

Note it was a question. As you mention, not everyone can do so (etc).


The question looked like "why are aren't you making a PR for this".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: