Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing a race with timed suspension (second attempt) #3158

Merged
merged 1 commit into from Feb 11, 2018

Conversation

sithhell
Copy link
Member

@sithhell sithhell commented Feb 8, 2018

When doing a timed suspension on a thread, there were several race conditions
between setting the different participating thread states, which should now be
fixed. The problem was observable with the wait_for_1751 regression test.

This is the second attempt (after #3153), fixing the previous issues.

@sithhell sithhell added this to the 1.1.0 milestone Feb 8, 2018
thread_priority priority = thread_priority_normal,
error_code& ec = throws)
{
std::atomic<bool> timer_started(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this atomic go out of scope before the timer thread can access it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@sithhell sithhell force-pushed the fix_timed_suspension branch 2 times, most recently from c0e5371 to e3ec5b7 Compare February 9, 2018 07:34
@sithhell
Copy link
Member Author

sithhell commented Feb 9, 2018

The inspect failure is not related to this PR. Pycicle tests run through and I verified that everything works locally. This PR is now potentially ready to be merged.

@hkaiser
Copy link
Member

hkaiser commented Feb 9, 2018

The inspect failure is not related to this PR. Pycicle tests run through and I verified that everything works locally. This PR is now potentially ready to be merged.

At least one of the inspect failures seems to be related to your changes (using atomic). Would you mind fixing the other one while you're at it as well?

When doing a timed suspension on a thread, there were several race conditions
between setting the different participating thread states, which should now be
fixed. The problem was observable with the wait_for_1751 regression test.
@sithhell
Copy link
Member Author

sithhell commented Feb 9, 2018

Right. missed the missing atomic header. The other inspect error is already fixed on master.

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now - thanks!

@sithhell sithhell merged commit 98effdc into master Feb 11, 2018
@sithhell sithhell deleted the fix_timed_suspension branch February 11, 2018 17:24
@msimberg msimberg mentioned this pull request Feb 12, 2018
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants