Replies: 5 comments 3 replies
-
A couple of thoughts: I wouldn't necessarily expect trapping to abort all other threads (and sorry that I missed commenting on this section earlier). I think there's a design question as to whether a thread trapping aborts all threads that it created. Another potential solution that avoids a dependency on EH would be to transform control flow so that early-exit can be done programmatically - this would be like a simpler version of the existing asyncify transformation. That being said, I think that the EH solution is quite nice since it also allows well-behaved cleanup. |
Beta Was this translation helpful? Give feedback.
-
I'm also surprised by the assumption that a trap aborts all other threads. That obviously isn't the case with web worker threads. I'm not even sure what "all other threads" should mean, since a trap in one "application" surely shouldn't take down threads from another application. So this supposes some kind of implicit thread grouping? I'd view a trap as an uncatchable internal form of exception, so it propagates in a structured manner. |
Beta Was this translation helpful? Give feedback.
-
Modules are purely a code organisation mechanism. As such, module boundaries should never affect operational behaviour, otherwise steps like static linking or splitting a module would silently change behaviour. Hence, any form of thread grouping mechanism must be independent from modules. Preferably, there is no need for any grouping mechanism at all. |
Beta Was this translation helpful? Give feedback.
-
i agree module boundary should not be used for grouping. what wasi-threads uses is:
i guess we can use a similar grouping here. |
Beta Was this translation helpful? Give feedback.
-
if i understand correctly, this github conversation is about early-exit, which is, how to allow a thread to terminate itself gracefully. if a trap should terminate "other threads in the group", or if a grouping is necessary at all, is a separate topic i guess. |
Beta Was this translation helpful? Give feedback.
-
Threads can exit by running out of instructions to execute or by trapping, but trapping aborts all other threads. In the case the user wants to early-exit a thread, e.g.,
pthread_exit
, but not end execution elsewhere, how should we propose to do so? In the section about thread exits, we suggest two options:thread.exit
Beta Was this translation helpful? Give feedback.
All reactions