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

Fixing issues with pthread implementation #8623

Closed

Conversation

abujalski
Copy link
Contributor

This PR aim at fixing some pthread implementation defects (in JavaScript glue layer) discovered when running POSIX tests from http://posixtest.sourceforge.net/ compiled to WebAssembly.

abujalski added 2 commits May 16, 2019 12:38
This patch aims for fixing failures in pthread related POSIX test from
clone of http://posixtest.sourceforge.net/

Following problems are addresed:
1. pthread_exit/2-2 test fails sometimes:
   Exit handlers must execute before setting threadStatus to exited
   (1). That's because setting threadStatus to 1 means main thread
   is free to deallocate the thread object. pthread_join is waiting
   for threadStatus to be set to 1.
2. pthread_cond_wait/2-3 test hang
  - Disabling recursive thread cancellation.
  - Allowing __timedwait_cp to be true cancellation point as _cp
    suffix suggests
  - Using PTHREAD_CANCEL_MASKED in __timedwait instead of
    pthread_cond_timedwait as in original musl implementation,
    because:
    1. pthread_cond_timedwait is cancellation point
    2. need to mark properly __timedwait as non cancellation point
       wait.
3. pthread_getschedparam/1-3 test hangs sometimes:
   In pthread_barrier_wait adding check if lock is held by main thread
   and waiting on futex in small slices of time there, to check if
   there is some work to do on behalf of Worker Threads.
Adding [email protected] to AUTHOURS file.
@VirtualTim
Copy link
Collaborator

Hey just so you know I'm working on a PR that implements/fixes detachable threads (and also fixes the leak in PThread.pthreads): #8286. Our changes look pretty independent, but I just thought you'd like to know.

@abujalski
Copy link
Contributor Author

@VirtualTim thanks for info :)

@kripken
Copy link
Member

kripken commented Jun 25, 2019

@juj, can you please take a look at this one, you know this code the best?

@sbc100 sbc100 closed this Jan 30, 2020
@kripken
Copy link
Member

kripken commented Jan 30, 2020

I think this was closed by mistake when we deleted the incoming branch (after switching to master), sorry about that. If this PR is still relevant please reopen and retarget to master.

@abujalski
Copy link
Contributor Author

I've checked and this PR is still relevant (tests from POSIX test suite hangs without this PR). However I've created new PR #10524 with these changes.

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.

4 participants