Re: [Cppcms-users] upgrade_lock and upgrade_to_unique_lock are not implemented in BOOSTER
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-08-24 12:22:34
|
Upgrading a lock from shared to unique can't be done in atomic way. It can't be done using POSIX API and it can't be done in Boost as well (see docs about upgrading). So if you want to upgrade the lock - just release shared lock and acquire unique one and of course be aware of the state that can change on between. So booster does not implement it as it is not really that useful. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: CN Liu <cn...@gr...> >To: cpp...@li... >Sent: Friday, August 23, 2013 7:10 PM >Subject: [Cppcms-users] upgrade_lock and upgrade_to_unique_lock are not implemented in BOOSTER > > > >Hi! > >I am trying to use boost::upgrade_lock and boost::upgrade_to_unique_lock as explained by Dalle in > >http://stackoverflow.com/questions/989795/example-for-boost-shared-mutex-multiple-reads-one-write > >---begin example code--- >void conditional_writer() >{ >boost::upgrade_lock< boost::shared_mutex > lock(_access); >// do work here, without anyone having exclusive access > >if (something) { > boost::upgrade_to_unique_lock< boost::shared_mutex > uniqueLock(lock); >// do work here, but now you have exclusive access >} > >// do more work here, without anyone having exclusive access >} >---end example code--- > >It appears that upgrade_lock and upgrade_to_unique_lock are not implemented in booster. Would someone please point me to the alternatives/workaround? > >Regards, >CN >------------------------------------------------------------------------------ >Introducing Performance Central, a new site from SourceForge and >AppDynamics. Performance Central is your source for news, insights, >analysis and resources for efficient Application Performance Management. >Visit us today! >http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |