Return a bool for HelperThreadTaskCallback
Categories
(Core :: XPConnect, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox80 | --- | fixed |
People
(Reporter: KrisWright, Assigned: KrisWright)
References
Details
Attachments
(1 file)
Right now, the HelperThreadTaskCallback
is just a void*
and the Spidermonkey side of thread pool dispatch can't interpret nsThreadPool
errors. I would like to create some error struct for HelperThreadPool
users to interpret errors from, to prevent further issues related to shutdown order and thread pool init. That way, if dispatch fails, Spidermonkey can handle the dispatch errors as needed.
I can see something like this working:
- Create some
DispatchResult
struct forjs::RunnableTask
and expose it to xpconnect - Make
HelperThreadTaskCallback
andDispatchOffthreadTask
return theDispatchResult
struct - Map the
nsResult
errors returned bynsThreadPool
toDispatchResult
to get the return value
Then, on the Spidermonkey side, users of HelperThreadPool
can determine how they want to handle an error (run synchronously, leak, assert).
Comment 1•4 years ago
|
||
Mostly we only need to know if the task was dispatched successfully, so returning a bool to indicate failure/success would be enough.
Assignee | ||
Comment 2•4 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #1)
Mostly we only need to know if the task was dispatched successfully, so returning a bool to indicate failure/success would be enough.
If Spidermonkey doesn't care about what kind of failures happen then I'm not opposed to this at all as it'd be much simpler to implement.
Assignee | ||
Comment 3•4 years ago
|
||
This changes HelperThreadTaskCallback
to be a bool
type callback and changes DispatchOffthreadTask
to return a bool type if gHelperThreads
successfully dispatches. The failure will be false
regardless of what kind of failure it is, but if JS doesn't care and only wants to know if there is a failure then this will be simpler than exposing a proper error enum. This also changes HelperThreadPool::Dispatch
to no longer return NS_OK
and instead returns whatever the nsResult
from the nsThreadPool may be.
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
Renaming this bug to better reflect what was actually changed.
Comment 6•4 years ago
|
||
bugherder |
Description
•