On 12/19/06, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote:
On 19.12.2006, at 17:08, Vlad Seryakov wrote: > I converted all to use pthreads directly instead of Tcl wrappers, and > now it does not crash anymore. Will continue testing but it looks like > Tcl is the problem here, not ptmalloc Where does it crash? I see you are just using Tcl_CreateThread Tcl_MutexLock/Unlock Tcl_JoinThread Those just fallback to underlying pthread lib. It makes no real sense. I believe.
Simply loading the Tcl library initialises a bunch of thread stuff, right? Also, the Tcl mutexes are self initialising, which includes calling down into the global Tcl mutex. Lots of stuff going on behind the scenes... NaviServer mutexes are also self initialising, but they call down to the pthread_ functions without touching any Tcl code, which may explain why the server isn't crashing all the time. So here's a test: what happens when you compile the test program to use Ns_Mutex and Ns_ThreadCreate etc.? Pthreads work, Tcl doesn't, how about NaviServer?