Skip to content

threads: implement support for conditional variables#323

Merged
abrown merged 1 commit intoWebAssembly:mainfrom
loganek:loganek/pthread_cond
Sep 6, 2022
Merged

threads: implement support for conditional variables#323
abrown merged 1 commit intoWebAssembly:mainfrom
loganek:loganek/pthread_cond

Conversation

@loganek
Copy link
Copy Markdown
Contributor

@loganek loganek commented Sep 5, 2022

The implementation is not as efficient as for native Linux platform due
to lack of FUTEX_REQUEUE-like system call in WASI.

For now we wake all the waiters which is inefficient; if that becomes
a bottleneck, I suggest we'll revisit the implementation.

The change is built on top of #320

@sbc100 sbc100 requested a review from abrown September 5, 2022 17:14
unlock_requeue(&node.prev->barrier, &m->_m_lock, m->_m_type & (8|128));
} else if (!(m->_m_type & 8)) {
a_dec(&m->_m_waiters);
a_dec(&m->_m_waiters);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

revert these 3 whitespace-only changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess that's to keep the source as close to musl as possible? I've reverted that (and two similar) changes.

@loganek loganek force-pushed the loganek/pthread_cond branch 3 times, most recently from 58bb614 to 51937f5 Compare September 6, 2022 12:12
@abrown
Copy link
Copy Markdown
Collaborator

abrown commented Sep 6, 2022

Rebase now that #320 is merged?

The implementation is not as efficient as for native Linux platform due
to lack of FUTEX_REQUEUE-like system call in WASI.

For now we wake all the waiters which is inefficient; if that becomes
a bottleneck, I suggest we'll revisit the implementation.
@loganek loganek force-pushed the loganek/pthread_cond branch from 51937f5 to f10a3e9 Compare September 6, 2022 20:44
@loganek
Copy link
Copy Markdown
Contributor Author

loganek commented Sep 6, 2022

@abrown rebased

@abrown abrown merged commit c40403f into WebAssembly:main Sep 6, 2022
john-sharratt pushed a commit to john-sharratt/wasix-libc that referenced this pull request Mar 6, 2023
The implementation is not as efficient as for native Linux platform due
to lack of FUTEX_REQUEUE-like system call in WASI.

For now we wake all the waiters which is inefficient; if that becomes
a bottleneck, I suggest we'll revisit the implementation.
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