-
Notifications
You must be signed in to change notification settings - Fork 55
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
use Julia ReentrantLock rather than fftw_make_planner_threadsafe #160
Conversation
This is a large portion of it, definitely! Though doesn't yet fix the deadlock. While this is a re-entrant lock, we shouldn't ever see it be re-entered from a given thread (whether on the same or a different task) as fftw doesn't like that. However, we might see that some |
I don't quite follow you. If a given thread holds the lock and FFTW is busy calling some thread-unsafe routine (e.g. creating or destroying a thread), how could a finalizer concurrently execute |
I see, so the scenario we are worried about is something like:
|
Maybe when That will get rid of all the business with a timer in #157, and allow garbage collection to function normally most of the time. |
That sounds great |
Okay, I updated the thread to defer plan destruction while the lock is held. (The plan-destruction queue itself requires a lock, and the logic of flushing the queue is a bit tricky to avoid deadlocks or race conditions, so I'd appreciate another pair of eyes to double-check my logic.) |
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.
I think this is on the right track, but may have some of the locked sections in the wrong order so that they don’t do what they are supposed to
…exclusive functions
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.
This seems correct to me.
Now that I think of it, it should actually be safe to use the regular So, it should be fine to destroy a plan in the thread that acquired the planner lock, even if that occurs during planning. reverted in b9e0000 |
Should fix #141. Closes #157.