Boost logo

Boost :

From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2004-01-19 19:12:16


On Mon, 19 Jan 2004 13:44:15 -0700
"Matt Sutton" <matt.sutton_at_[hidden]> wrote:

>
> > You have to build a multithreaded version of the signals
> > library (which
> > it seems you have),
>
> Pardon the slightly off topic question, but is the Boost Signals
> library now thread safe? The documentation seems to indicate
> otherwise, specifically the FAQ.

I do not know. That part in the doc is a bit vague. I take it to mean
that it is not thread safe by itself, but if you provide the necessary
locking around calls, then it will be. However, it does use shared_ptr,
which enforces locking if compiled with multithreading enabled (IMHO
this is a very unfortunate design decision).
Thus, if you compile your code with threading enabled, then it includes
the signal headers, which include the shared_ptr headers, which (via
#ifdef code) insert a call to acquire a mutex anytime the shared counter
#is accessed/updated (when compiled in multi-threading mode). Since
#part of the implementation of signals is in a library, this means that
#you must link against a signals library built for multi-threading as
#well or your object code will conflict.

However, I do not think any of this contradicts anything in the
documentation.

-- 
Jody Hagins
Actually, my goal is to have a sandwich named after me.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk