Приветствую.
Собственно, мне нужно заиметь вспомогательный поток, при этом не пользуясь pthread.
Заиметь-то я его заимел с помощью clone() (без CLONE_PARENT), поток завершается с помощью syscall(__NR_exit, 0) — а как теперь его подождать в основном потоке? waitpid(tid, NULL, __WALL) говорит -ECHILD.
UPD: окей, ман говорит, что так делать нельзя:
A new thread created with CLONE_THREAD has the same parent
process as the caller of clone() (i.e., like CLONE_PARENT), so
that calls to getppid(2) return the same value for all of the
threads in a thread group. When a CLONE_THREAD thread
terminates, the thread that created it using clone() is not
sent a SIGCHLD (or other termination) signal; nor can the
status of such a thread be obtained using wait(2). (The
thread is said to be detached.)
А как тогда?


