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 thread exit and thread cancellation #10524

Merged
merged 1 commit into from
Feb 16, 2021

Commits on Feb 16, 2021

  1. Fixing thread exit and thread cancellation (emscripten-core#12985)

    This patch fixes thread cancellation/exit method and also unifies why
    how thread structures are updated when thread is canceled or exits.
    
    Following problems are addressed:
    1. heap-use-after-free on std::thread emscripten-core#12985
       Function `cleanupThread()` from `src/library_pthread.js`
       unconditionally set `pthread.self` member of pthread structure to 0.
       Problem was that `cleanupThread()` function might be called after
       that pthread structure has been deleted. To fix this problem, setting
       `pthread.self` field is now guarded by check if thread data hasn't
       been already freed.
    2. pthread_cond_wait/2-3 test hang
      - Disabling recursive thread cancellation.
      - Allowing __timedwait_cp to be true cancellation point as _cp
        suffix suggests
    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.
    
    Signed-off-by: Adam Bujalski <[email protected]>
    abujalski committed Feb 16, 2021
    Configuration menu
    Copy the full SHA
    a342a1d View commit details
    Browse the repository at this point in the history