Question about threading implementation

David Xu davidxu at freebsd.org
Mon Mar 7 17:23:02 PST 2005


Jonathon McKitrick wrote:
On Mon, Mar 07, 2005 at 11:43:53AM +1000, Andrew Hacking wrote:
: Calling sleep() in a multi-threaded program is probably not safe since
: it suspends the process, not just the thread.
: You should always call nanosleep() in multi-threaded apps.
Are you sure nanosleep() doesn't suspend the process?

: The core dump is not pretty through....

I found the problem.

Not only does the library with the threads need to be linked against
-pthread or -lthread_xu, but the main app does as well.
Jonathon McKitrick
--
My other computer is your Windows box.
Hi Jonathon,

libthread_xu does not fully work on DragonFly yet, although
it works well as best performance library on FreeBSD when doing
real world benchmarks. This dues to missing features in
DragonFly kernel. Current I would like to sweep cleanly
userland code, only __thread tls support and debugging
support are left. for debugging support, I would like to
delay it since it also needs support from kernel, I had
done kernel support and userland gdb support on FreeBSD,
I think I can repeat it on DragonFly once kernel can
support multithreads process natively.
Current I can run most of David R.Butenhof's test programs
of his book "Programming with POSIX threads" and other simple
test programs.
David Xu





More information about the Users mailing list