Boost logo

Boost Users :

From: Uwe Sander (usander_at_[hidden])
Date: 2004-01-08 12:25:03


Hi,

I have a problem with boost::signals when I try to use them in multi threaded
projects. I have tried gcc 3.2.3 and gcc 3.3.2, on two different Linux boxes,
with the same result. The following test program works fine w/o threads and
crashes after the 17th call to connect if I add -pthread to the compile
command:

#include <boost/signal.hpp>

void on_do_something ()
{
}

int main ()
{
        boost::signal<void ()> sig;
        
        for (int i = 0; i < 100; ++i)
                sig.connect (&on_do_something);
}

I have tried electric fence, then it crashes immediatly in the first call to
pthread_mutex_init, but I can't see any reason for that crash with gdb. Once
again, even with electric fence, everything works fine w/o threads, so I see
no mem corruption or any reason why it should not work _with_ threads.
Any idea?

Thanks
Uwe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net