• R
    trap UB from attempts to join a detached thread · 80bf5952
    Rich Felker 提交于
    passing to pthread_join the id of a thread which is not joinable
    results in undefined behavior.
    
    in principle the check to trap does not necessarily work if
    pthread_detach was called after thread creation, since no effort is
    made here to synchronize access to t->detached, but the check is
    well-defined and harmless for callers which did not invoke UB, and
    likely to help catch erroneous code that would otherwise mysteriously
    hang.
    
    patch by William Pitcock.
    80bf5952
pthread_join.c 1.1 KB