Opened 5 years ago

#13162 new Bugs

Sharable Lock And Upgradable Lock documentation

Reported by: anonymous Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.64.0 Severity: Not Applicable
Keywords: boost docs Cc:

Description

http://www.boost.org/doc/libs/1_64_0/doc/html/interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.sharable_upgradable_mutexes.sharable_upgradable_locks

The documentation of the interprocess sharable and upgradable locks state that "Boost.Interprocess mutexes are best used with the scoped_lock utility, and this class only offers exclusive locking.".

Then goes on to explain to use sharable_lock and upgradable_lock. Then shows some examples; but the example for a timed lock is wrong or misleading:

{

boost::posix_time::ptime abs_time = ...

This will call timed_lock_sharable() scoped_lock<SharableOrUpgradableMutex> lock(sh_or_up_mutex, abs_time);

Check if the mutex has been successfully locked if(lock){

Some code

} If the mutex was locked it will be unlocked

}

The example basically says that the scoped_lock will acquire a sharable lock (saying that it will call timed_lock_sharable())! This should read "sharable_lock<..." instead of "scoped_lock<..." same with upgradable lock.

Change History (0)

Note: See TracTickets for help on using tickets.