-
Notifications
You must be signed in to change notification settings - Fork 244
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
Fixes for running dedicated built-in mi.Threads #138
base: master
Are you sure you want to change the base?
Conversation
Hi Tobias, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two first commits look good to me.
Regarding the third commit, I will let Wenzel take a lot a this patch, he is more familiar with this part of the codebase.
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
else { | |
} else { |
4af72bd
to
199b607
Compare
df4cbe0
to
64fedcd
Compare
3f3b8d0
to
1bdea6e
Compare
Bugfix
Description
Two of the three commits are simple Thread class fixes (no undefined default priorities, give back GIL while waiting for Thread methods to resume).
The third commit addresses a rather ugly conflict between
mi.Thread
-derived andThreadNotifier
WorkerThread
instances. I am sure you are well aware of the somewhat unfortunate layering of threading functionality at this point. The provided fix addresses too possible implementations of C++thread_local
storage:ThreadNotifier
initialization on thread start (not actually happening on my system), in which case the fix now replaces theWorkerThread
instance by the instance of the dispatchedmi.Thread
-derived object with proper reference counting and destruction.ThreadNotifier
, in which case the fix prevents correctmi.Thread
-derived objects to accidentally be replaced with anonymousWorkerThread
instances that easily lead to crashes when lacking the right ThreadEnvironment settings.Testing
Minimal repro (Ubuntu 20.04 LTS, Python 3.8):
Checklist:
Please make sure to complete this checklist before requesting a review.
cuda_*
andllvm_*
variants. If you can't test this, please leave below[ ] I have made corresponding changes to the documentation[ ] I have added tests that prove my fix is effective or that my feature works