PTHREAD_COND_INITIALIZER: pthread_cond_wait case #123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@maxwellpirtle ,
FROM @gc00: After I created this PR, I realized that we don't really need it. We check for uninitialized cond in
transitions/cond/MCEnqueue.cppalready. And McMini should guarantee that that will always precedetransitions/cond/MWait.cpp. We could push in this PR, or just push in the comments that remind us that MCEnqueue already checks for uninitialized cond vars.(I originally was tracking down the bug for sleep sets that we discussed. But at first, I wrongly diagnosed it as an uninitialized cond var in pthread_cond_wait.)
Could you check the logic carefully for this? I'm worried about the case in which the cond var was initialized, but maybe the mutex argument was never initialized.
Could you look at this soon? I don't want to push any other PRs in, until we can push this PR with the bug fix. Otherwise, our history would have several commits in the environment of an obscure bug.
Typically, the user should enclose pthread_cond_wait inside a pthread_mutex_lock/unlock. But maybe some user forgot to do that, or had used a different mutex for the lock/unlock. We need McMini to catch this bug.