By being detached the threads are not joinable which makes waiting for the termination of threads error-prone (a sleep after they are done processing should yield to allow them to complete assuming the OS scheduler is scheduling quickly, but joining is more dependable to ensure the thread stacks are freed). So, it would be helpful to have a way to ensure the athreads are joinable (in the interface for POSIX threads). It would be beneficial for things like memory leak checking (things that wait for program termination).
Currently, all threads are created detached with
PTHREAD_CREATE_DETACHED
at: https://github.com/githwxi/ATS-Postiats/blob/7f5bea78c8849e730ca9b89bb513d25674b06ae5/libats/DATS/athread_posix.dats#L352-L362By being detached the threads are not joinable which makes waiting for the termination of threads error-prone (a sleep after they are done processing should yield to allow them to complete assuming the OS scheduler is scheduling quickly, but joining is more dependable to ensure the thread stacks are freed). So, it would be helpful to have a way to ensure the athreads are joinable (in the interface for POSIX threads). It would be beneficial for things like memory leak checking (things that wait for program termination).