cprogrammer
cprogrammer

Reputation: 5675

boost::shared_ptr references?

I need something similar to this:

boost::shared_ptr<A>  _class(...);

//Start async operation
boost::aiso::post(_class);

_class.relase();

while(_class)     // not working
{
   LOG("Wait for aync operation to complete");
}

Upvotes: 0

Views: 82

Answers (1)

Igor R.
Igor R.

Reputation: 15085

Yes, it's safe, because post copies its argument (I guess you mean io_service_.post()). See the documentation here.

But after you call _class.release(), !!_class will always be false, so while(_class) will never execute the loop body.

Upvotes: 1

Related Questions