Boost logo

Boost Users :

Subject: [Boost-users] [boost-users][signals2] thread-safe disconnection for intrusively ref-counted objects
From: Igor R (boost.lists_at_[hidden])
Date: 2009-05-12 12:17:47


Hello,

Is there any trick or customization that would allow the subj?
I mean the following situation:

// pseudo-code!
class intrusively_refcounted : //...
{
private:
  void listenToAsyncSubsystem()
  {
    // signals will come from another thread
    asyncSubsystem_.someEvent.connect(slot_type(&intrusively_refcounted::handler,
this).track(???)); // can't use here shared_ptr/weak_ptr for tracking
  }
};

I could store a connection object, so that it would be
destroyed/disconnected in ~intrusively_refcounted(), but I guess it's
not thread-safe, just like the approach with "trackable".

So what would be the correct approach?

Thanks!


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