Skip to content
  • Samuel Williams's avatar
    2d4f29e7
    Fix potential hang when joining threads. · 2d4f29e7
    Samuel Williams authored
    If the thread termination invokes user code after `th->status` becomes
    `THREAD_KILLED`, and the user unblock function causes that `th->status` to
    become something else (e.g. `THREAD_RUNNING`), threads waiting in
    `thread_join_sleep` will hang forever. We move the unblock function call
    to before the thread status is updated, and allow threads to join as soon
    as `th->value` becomes defined.
    
    This reverts commit 6505c775.
    2d4f29e7
    Fix potential hang when joining threads.
    Samuel Williams authored
    If the thread termination invokes user code after `th->status` becomes
    `THREAD_KILLED`, and the user unblock function causes that `th->status` to
    become something else (e.g. `THREAD_RUNNING`), threads waiting in
    `thread_join_sleep` will hang forever. We move the unblock function call
    to before the thread status is updated, and allow threads to join as soon
    as `th->value` becomes defined.
    
    This reverts commit 6505c775.
Loading