PTHREAD_COND_INITIALIZER: pthread_cond_wait case#123
Open
gc00 wants to merge 1 commit intomcminickpt:mainfrom
Open
PTHREAD_COND_INITIALIZER: pthread_cond_wait case#123gc00 wants to merge 1 commit intomcminickpt:mainfrom
gc00 wants to merge 1 commit intomcminickpt:mainfrom
Conversation
* This case was forgotten in the implementation in 9f5fc3b
b3c2b16 to
ece8633
Compare
maxwellpirtle
approved these changes
Jun 6, 2024
Collaborator
maxwellpirtle
left a comment
There was a problem hiding this comment.
We've discussed these changes together
8dabc7e to
813d1b6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.