We cannot actually rely on a status (finish) before thr_exit. The
thread needs the kernel signal status=1 to userspace. Before that,
any tryjoin fails. The previous one works as we sleep 1 and should be
enough for normal case.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 78328 Build 75211: arc lint + arc unit
Event Timeline
You could query the kernel to see the state of the thread using kinfo_proc().
Somewhat curiously, I thought about adding an API to query the list of the threads for the current process.
I mean this robustness change is needed as we are testing pthread_tryjoin_np, which should not query status by using kinfo_proc.
I still do not understand why should it not. Using kinfo would make the test more precise IMO, But I do not intend to block this change.
I also do not really understand. It seems fine to use kinfo. See tests/sys/kern/procdesc.c:wait_for_naptime() for an example. It is just an alternative method to avoid polling while you are waiting for thr_fun() to wake up.
I guess, it's somewhat dubious to assume that pthreads and kernel threads map 1:1 with each other? I think that is probably still reasonable within a libthr test, but ok.
Yes but it is an external channel for the information, so you are not affected by a possible bug in the tested function.