
Howard Hinnant
On Mar 14, 2011, at 11:39 PM, DesertFish wrote:
It looks like you are locking your structure in "read mode" and then writing
to it:
boost::shared_lockboost::shared_mutex lock(rwMutex); for(boost::unordered_set<int>::iterator it=tablePush[pair
(type, code)].begin();it!=tablePush[pair (type, code)].end ();it++){ flag=true; des->push_back(*it); } If you want to lock it in write mode do this:
boost::unique_lockboost::shared_mutex lock(rwMutex);
-Howard
Hi Howard,
I just tested a simple case,
which just lock the read lock and print out the result
of tablePush.size(), like this:
bool getFD(list<int> *des, char *type, char *code){
bool flag=false;
boost::shared_lockboost::shared_mutex lock(rwMutex);
cout<