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

Do not create worker with no ThreadLocal storage #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GabrielSibley
Copy link

When compiled with multithreading enabled and run with a CPU count of 1, the task scheduler would create 1 worker thread. However, ThreadLocal<T> will not allocate any storage for this worker thread during its initialization, as the array length is determined from CPU count and not worker count. This generally results in the worker thread segfaulting, e.g. when trying to dereference an uninitialized pointer.

Proposed fix: Do not create any worker threads when run with 1 CPU.

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.

1 participant