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

wasi-threads: basic simplistic implementation of wasi-threads proposal #1638

Closed

Conversation

loganek
Copy link
Collaborator

@loganek loganek commented Oct 25, 2022

wasi-threads proposal: https://github.com/WebAssembly/wasi-threads

This is very very basic implementation, probably doesn't cover a lot of corner cases. I open the PR here to get early feedback on the direction, missing bits and suggestions.

Also, I think it'd be good to have a separate branch for that (dev/wasi-threads?) so if we can have it setup that'd be great.

@wenyongh wenyongh changed the base branch from main to dev/wasi_threads October 26, 2022 00:16
@wenyongh
Copy link
Contributor

wasi-threads proposal: https://github.com/WebAssembly/wasi-threads

This is very very basic implementation, probably doesn't cover a lot of corner cases. I open the PR here to get early feedback on the direction, missing bits and suggestions.

Also, I think it'd be good to have a separate branch for that (dev/wasi-threads?) so if we can have it setup that'd be great.

@loganek Thanks for uploading the PR! I have created branch dev/wasi_threads and changed the PR's destination branch to it.

Copy link
Collaborator

@yamt yamt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

int global_value = 0;

void
sleep(int64_t time_ns)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please avoid overriding unistd.h sleep(3). my suggestion is sleep_ns.

pthread_cond_t cond;
pthread_mutex_t mp;

int global_value = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

volatile?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answering myself, volatile isn't necessary here as surrounded by mutex calls.

info->start_func = start_func;
info->exec_env = new_exec_env;

ret = pthread_create(&th, NULL, thread_start, info);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess you should use os_thread_create.

@wenyongh wenyongh deleted the branch bytecodealliance:dev/wasi_threads December 6, 2022 09:34
@wenyongh wenyongh closed this Dec 6, 2022
@wenyongh wenyongh reopened this Dec 6, 2022
@loganek
Copy link
Collaborator Author

loganek commented Dec 6, 2022

Closing this PR in favor of the #1783 PR (and further PRs).

@loganek loganek closed this Dec 6, 2022
wenyongh pushed a commit that referenced this pull request Dec 6, 2022
eloparco pushed a commit to eloparco/wasm-micro-runtime that referenced this pull request Dec 11, 2022
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
@loganek loganek deleted the loganek/threads branch June 10, 2024 12:48
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

Successfully merging this pull request may close these issues.

3 participants