Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return from _start #21

Open
yamt opened this issue Jan 4, 2023 · 0 comments
Open

return from _start #21

yamt opened this issue Jan 4, 2023 · 0 comments

Comments

@yamt
Copy link
Contributor

yamt commented Jan 4, 2023

a. some people think a return from _start should be an equivalent of thread_exit. (ie. same as a return from wasi_thread_start)

b. other people think it should be an equivalent of proc_exit(0). (ie. it should terminate other threads.)

c. maybe "leave it undefined for threaded apps for now" is also a valid choice if we make wasi-libc _start call proc_exit explicitly.

i guess it's up to wasi-threads to decide either ways because, without threads, thread_exit and proc_exit are basically same.

cf. WebAssembly/wasi-libc#367

yamt added a commit to yamt/wasi-threads that referenced this issue Jul 6, 2023
a return from _start is an equivalent of proc_exit(0) and thus should
terminate other threads.
at least it's what wasi-libc as of today assumes.

cf. WebAssembly#21

```
(venv) spacetanuki% python3 test-runner/wasi_test_runner.py -t ../wasi-threads/test/testsuite -r ~/git/toywasm/test/wasi-testsuite-adapter.py
Test wasi_threads_exit_nonmain_wasi passed
Test wasi_threads_exit_main_busy passed
Test wasi_threads_return_main_wasi passed
Test wasi_threads_return_main_wasi_read passed
Test wasi_threads_return_main_block passed
Test wasi_threads_exit_main_wasi passed
Test wasi_threads_return_main_busy passed
Test wasi_threads_exit_nonmain_busy passed
Test wasi_threads_spawn passed
Test wasi_threads_exit_main_block passed
Test wasi_threads_exit_nonmain_wasi_read passed
Test wasi_threads_exit_nonmain_block passed
Test wasi_threads_exit_main_wasi_read passed

===== Test results =====
Runtime: toywasm v28.0.0
Suite: WASI threads proposal
  Total: 13
  Passed:  13
  Failed:  0
  Skipped: 0

Test suites: 1 passed, 0 total
Tests:       13 passed, 0 total
(venv) spacetanuki%
```
abrown pushed a commit that referenced this issue Aug 23, 2023
* add another set of tests to examine "return from _start"

a return from _start is an equivalent of proc_exit(0) and thus should
terminate other threads.
at least it's what wasi-libc as of today assumes.

cf. #21

```
(venv) spacetanuki% python3 test-runner/wasi_test_runner.py -t ../wasi-threads/test/testsuite -r ~/git/toywasm/test/wasi-testsuite-adapter.py
Test wasi_threads_exit_nonmain_wasi passed
Test wasi_threads_exit_main_busy passed
Test wasi_threads_return_main_wasi passed
Test wasi_threads_return_main_wasi_read passed
Test wasi_threads_return_main_block passed
Test wasi_threads_exit_main_wasi passed
Test wasi_threads_return_main_busy passed
Test wasi_threads_exit_nonmain_busy passed
Test wasi_threads_spawn passed
Test wasi_threads_exit_main_block passed
Test wasi_threads_exit_nonmain_wasi_read passed
Test wasi_threads_exit_nonmain_block passed
Test wasi_threads_exit_main_wasi_read passed

===== Test results =====
Runtime: toywasm v28.0.0
Suite: WASI threads proposal
  Total: 13
  Passed:  13
  Failed:  0
  Skipped: 0

Test suites: 1 passed, 0 total
Tests:       13 passed, 0 total
(venv) spacetanuki%
```

* remove unused imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant