3 ms·
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 r
by comex 8y ago
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`.
- justinclift 8y agoDo a PR or equivalent?
- saagarjha 8y agoFriendly 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…
- justinclift 8y ago??? Note it was a question. As you mention, not everyone can do so (etc).
- saagarjha 8y agoThe question looked like "why are aren't you making a PR for this".