Boost logo

Boost Users :

From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2007-02-19 17:48:58


On 2/19/07, Timmo Stange <ts_at_[hidden]> wrote:
> Gottlob Frege wrote:
>
>
> On a side note: I don't know if you've followed the tracking
> functionality changes we've discussed. In a nutshell, we agreed
> that shared_ptr/weak_ptr is the most portable, useful solution
> in a multi-threaded environment. Since this kind of tracking
> ensures the lifetime of the tracked objects during a slot call,
> a weak disconnect would not keep users from safely releasing
> resources associated with a slot - as long as they're tracked.
>

I'm trying to keep up but it's not easy!

> > P.S. what about connect/disconnect 'pairing'? ie is there an assumed
> > (or explicit) contract that every call to connect is matched by a
> > disconnect? If I have a slot that is in a signal, and that SAME
> > signal is triggered in, say, 3 threads, the slot can't just call
> > disconnect() (ie the same code in each thread) - it has to somehow
> > carefully keep track that it is calling disconnect() in 1 thread, and
> > the other 2 threads need to skip the disconnect() call.
> >
> > Or does that matching guarantee not exist?
>
> I don't think I understood this. You can only connect a slot once -
> if you connect it twice it will be a separate connection and the slot
> will be called twice. You can only disconnect it once accordingly,
> although trying to disconnect it several times won't do any harm.
>

Ignore me. I was translating in my head between different
implementations of the same broadcaster/observer patterns. In the one
I was last using, the 'subscribe' and 'unsubscribe' in matched pairs.

> Regards
>
> Timmo Stange
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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