You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Burned myself with this one with Threads.@spawn multithreading.
The Opt object is not thread-safe, and reusing it leads to problems.
I'd argue this is enough of a footgun that possibly NLopt.jl could try to detect if the same Opt object is being used simultaneously by multiple threads.
Could a flag be added to struct Opt that is set to true when accepted by optimize and false just before returning? And if the flag is already true, emit a warning or error? I suppose you'd also need a try/catch/finally to ensure it's reset to false even if there's an internal exception or interrupt.
(Accidentally posted in an unrelated issue).
The text was updated successfully, but these errors were encountered:
Burned myself with this one with
Threads.@spawn
multithreading.The
Opt
object is not thread-safe, and reusing it leads to problems.I'd argue this is enough of a footgun that possibly NLopt.jl could try to detect if the same Opt object is being used simultaneously by multiple threads.
Could a flag be added to struct Opt that is set to true when accepted by optimize and false just before returning? And if the flag is already true, emit a warning or error? I suppose you'd also need a try/catch/finally to ensure it's reset to false even if there's an internal exception or interrupt.
(Accidentally posted in an unrelated issue).
The text was updated successfully, but these errors were encountered: