Forum Stats

  • 3,851,386 Users
  • 2,263,969 Discussions


Threads and tsearch(3) problem

I am having a problem with programs linked with either the posix or solaris thread libraries and using the tsearch(3) routines. The specifics are a program linked normally without -lthread or -lpthread and using twalk where tdelete is called in the action routine works fine. If I link the program with -lthread or -lpthread the tdelete call inside of the action function will cause a self-block. I think what is happening is that the wrapper routine for the thread library is establishing a mutex on the root of the tree, then the actual library twalk routine calls the action function. Then, the action function calls tdelete with the same root of the tree and the thread wrapper tries to get the mutex on the same root value, thus causing a self-blocking deadlock.

I would like to know if this is a known situation and if there is a work around, or hasn't any one else run into this?

Randy Hands
[email protected]
This discussion has been closed.