Question

Im transferring some code from ACE to Poco. I'm new to multithreaded design so it is confusing me just a little!

typedef Arc::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult;

Im not able to just re-write it like this, as Poco::AutoPtr only accepts one argument as a class template

typedef Poco::AutoPtr<ResultSet, Poco::Mutex> QueryResult;

How should i write it?

Was it helpful?

Solution

I'm not sure what Arc::AutoPtr is, because I couldn't find anything like that in the ACE documentation. However if it's the same as ACE_Refcounted_Auto_Ptr then the corresponding typedef for Poco would probably be typedef Poco::SharedPtr<ResultSet> QueryResult;. But it's not clear from the docs whether the SharedPtr in Poco implements a thread safe reference counting, so you have to be careful of that.

Poco::AutoPtr is actually an intrusive smart pointer which requires support from the pointed type (similar to boost::intrusive_ptr).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top