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
Troves accept threads that will be closed when the trove is cleaned up. However, if this thread is the currently-running thread or marked as the "normal" thread, then it will throw an error. Here are a couple repros:
trove:Add(coroutine.running())
trove:Clean()
-- Error: cannot close running coroutine
trove:Add(coroutine.running())
task.spawn(function()
trove:Clean()
end)
-- Error: cannot close normal coroutine
A thread that is in the "running" state means that it is the currently-active coroutine. A thread that is in the "normal" state means that it has resumed another coroutine and is awaiting that coroutine to yield back.
Thus, another example of the "normal coroutine" error would be such:
localthread1, thread2thread1=coroutine.create(function()
trove:Clean()
end)
thread2=coroutine.create(function()
trove:Add(thread2)
task.spawn(thread1)
end)
task.spawn(thread2)
-- Error: cannot close normal coroutine
And thus comes the question: How should Trove handle this? Should it just have better error messaging? Ideally, developers should only be placing threads into a Trove that they know will be fine to be closed. Simply checking the thread status on Add won't cut it, because that would assume that Clean would be called from the same thread that Add was called, which may not be the case.
The text was updated successfully, but these errors were encountered:
Troves accept threads that will be closed when the trove is cleaned up. However, if this thread is the currently-running thread or marked as the "normal" thread, then it will throw an error. Here are a couple repros:
A thread that is in the "running" state means that it is the currently-active coroutine. A thread that is in the "normal" state means that it has resumed another coroutine and is awaiting that coroutine to yield back.
Thus, another example of the "normal coroutine" error would be such:
And thus comes the question: How should Trove handle this? Should it just have better error messaging? Ideally, developers should only be placing threads into a Trove that they know will be fine to be closed. Simply checking the thread status on
Add
won't cut it, because that would assume thatClean
would be called from the same thread thatAdd
was called, which may not be the case.The text was updated successfully, but these errors were encountered: