Boost logo

Boost Users :

Subject: Re: [Boost-users] [signals2] tracking intrusively ref-counted object
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2009-09-08 11:13:53


> b) eliminate race condition between slot invocation (coming from
> asyncSubsystem's thread) and the destruction of Object caused by
> resetting of user's intrusive ptr
>
> I tried to think of different ways to solve (b), but nothing seems to
> work so far... So my question is whether (b) is ever possible, and
> what would be the right solution for the whole issue.
>
> Thank you,
>
> Igor'.

Have the use of an object only go through an owning pointer.
Resetting the pointer to drop the object will still allow pending calls to finish (so it has to watch its own pointers while stuff is changing around it), and the destructor won't be called until all calls are done.

If your use is some more exotic situation, just make sure you follow the principle of the caller establishing ownership first. Resetting the data structure's pointer won't cause destruction (yet).

--John

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


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