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

Fix the construction of WorkContext #184

Merged
merged 1 commit into from
Aug 6, 2016
Merged

Conversation

darkf
Copy link
Collaborator

@darkf darkf commented Aug 5, 2016

Previously the worker thread was constructed before the queue was, leading to
unfortunate race conditions. This fixes that, along with unrelated minor cleanup.


std::queue<WorkJob*> _workQueue;
std::queue<WorkJob*> _completeQueue;

std::mutex _inMutex;
std::mutex _outMutex;
std::unique_ptr<LoadWorker> _worker;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be worth adding a comment somewhere that the order is important here.
I guess the average user wouldn't think of it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JayFoxRox done

Previously the worker thread was constructed before the queue was, leading to
unfortunate race conditions. This fixes that, along with unrelated minor cleanup.
@JayFoxRox
Copy link
Collaborator

Seems to fix the crashes I've been getting lately.
Tested in Test mode and started / quit repeatedly. Not a single crash :)
Code also reviewed.

LGTM

@danhedron danhedron merged commit a0057d1 into rwengine:master Aug 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants