|
Boost Users : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-07-10 22:20:23
> When using Boost.Threads, can I make concurrent calls to connect as long
> as I wrap each call in a Mutex?
Sure, so long as you aren't connecting to the same signal at the same time.
> If this is possible, do tackable objects also still work
> (if two trackable objects get destroyed in two different threads there
> might be a problem from what I understand)
Yes, that would be a problem. I don't think I would recommend using
trackable objects in a multithreaded environment, because destruction of an
object in one thread could interfere with, e.g., calling a signal in another
thread. Wrapping a mutex around that would not be easy.
> On an different note, I am trying to use Boost.Signals for network event
> handling. I'd like to set it up so that it uses something similar to he
> JavaScript event model, where every slot returns a boolean value.
> If that value is false, the remaining slots are not called.
> Would anyone have any recommendations on how to do this?
> Should I wrap each slot in a function that takes the return value and
> sets a global flag, then every subsequent slot checks the flag?
No need for that...
> It looks like combiners would not be appropriate, as it appears they are
> used after each slot is called (unless the InputIterator' opeator*
> actually calls the slot??)
Combiners would be appropriate! operator* does actually call the slot, so
you need a Combiner like this:
struct _call_until
{
typedef void result_type;
template<typename InputIterator>
void operator()(InputIterator first, InputIterator last) const
{
while (first != last && *first) ++first;
}
};
My apologies for the slow turnaround time.
Doug
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