@@ -177,6 +177,45 @@ TID is a 32-bit integer to identify threads created with `wasi_thread_spawn`.
177177 For example, it can be used to indicate the main thread, which doesn't
178178 have a TID in the current version of this proposal.
179179
180+ ### Process
181+
182+ * A process is a group of threads.
183+
184+ * The main thread starts with a process which only contains
185+ the main thread.
186+
187+ * Threads created by a thread in a process using `wasi_thread_spawn`
188+ are added to the process.
189+
190+ * When a thread is terminated, it's removed from the process.
191+
192+ ### Voluntary thread termination
193+
194+ A thread can terminate itself voluntarily by returning from
195+ `wasi_thread_start`.
196+
197+ ### Changes to WASI `proc_exit`
198+
199+ With this proposal, the `proc_exit` function takes extra responsibility
200+ to terminate all threads in the process, not only the calling one.
201+
202+ Any of the threads in the process can call `proc_exit`.
203+
204+ ### Traps
205+
206+ When a trap occurs in any thread, the entire process is terminated.
207+
208+ ### Process exit status
209+
210+ If one or more threads call WASI `proc_exit` or raise a trap,
211+ one of them is chosen by the runtime to represent the exit status
212+ of the process.
213+ It's non deterministic which one is chosen.
214+
215+ If all the threads in the process have been terminated without calling
216+ `proc_exit` or raising a trap, it's treated as if the last thread called
217+ `proc_exit` with exit code 0.
218+
180219#### Design choice: pthreads
181220
182221One of the goals of this API is to be able to support `pthreads` for C compiled
0 commit comments