Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80147 - in trunk/libs/interprocess: doc proj/vc7ide test
From: igaztanaga_at_[hidden]
Date: 2012-08-22 17:03:31


Author: igaztanaga
Date: 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
New Revision: 80147
URL: http://svn.boost.org/trac/boost/changeset/80147

Log:
[named_/interprocess]sharable_mutex & [named_/interprocess]condition_any implemented
Added:
   trunk/libs/interprocess/proj/vc7ide/condition_any_test.vcproj (contents, props changed)
   trunk/libs/interprocess/proj/vc7ide/named_condition_any_test.vcproj (contents, props changed)
   trunk/libs/interprocess/proj/vc7ide/named_sharable_mutex.vcproj (contents, props changed)
   trunk/libs/interprocess/proj/vc7ide/sharable_mutex.vcproj (contents, props changed)
   trunk/libs/interprocess/test/condition_any_test.cpp (contents, props changed)
   trunk/libs/interprocess/test/named_condition_any_test.cpp (contents, props changed)
   trunk/libs/interprocess/test/named_sharable_mutex_test.cpp (contents, props changed)
   trunk/libs/interprocess/test/sharable_mutex_test.cpp (contents, props changed)
Text files modified:
   trunk/libs/interprocess/doc/interprocess.qbk | 127 ++++++++++++++++++++++++++++-----------
   trunk/libs/interprocess/proj/vc7ide/Interprocess.sln | 16 +++++
   trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj | 24 +++++++
   3 files changed, 129 insertions(+), 38 deletions(-)

Modified: trunk/libs/interprocess/doc/interprocess.qbk
==============================================================================
--- trunk/libs/interprocess/doc/interprocess.qbk (original)
+++ trunk/libs/interprocess/doc/interprocess.qbk 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2005-2011 Ion Gaztanaga
+ / Copyright (c) 2005-2012 Ion Gaztanaga
  /
  / Distributed under the Boost Software License, Version 1.0. (See accompanying
  / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -1587,11 +1587,26 @@
 
 [c++]
 
+ #include <boost/interprocess/sync/interprocess_condition_any.hpp>
+
+* [classref boost::interprocess::interprocess_condition_any interprocess_condition_any]:
+ An anonymous condition variable that can be placed in shared memory or memory
+ mapped files to be used with any lock type.
+
+[c++]
+
    #include <boost/interprocess/sync/named_condition.hpp>
 
 * [classref boost::interprocess::named_condition named_condition]: A named
   condition variable to be used with [classref boost::interprocess::named_mutex named_mutex].
 
+[c++]
+
+ #include <boost/interprocess/sync/named_condition_any.hpp>
+
+* [classref boost::interprocess::named_condition named_condition]: A named
+ condition variable to be used with any lock type.
+
 Named conditions are similar to anonymous conditions, but they are used in
 combination with named mutexes. Several times, we don't want to store
 synchronization objects with the synchronized data:
@@ -1720,12 +1735,12 @@
 
 [endsect]
 
-[section:upgradable_mutexes Upgradable Mutexes]
+[section:sharable_upgradable_mutexes Sharable and Upgradable Mutexes]
 
-[section:upgradable_whats_a_mutex What's An Upgradable Mutex?]
+[section:upgradable_whats_a_mutex What's a Sharable and an Upgradable Mutex?]
 
-An upgradable mutex is a special mutex that offers more locking possibilities than
-a normal mutex. Sometimes, we can distinguish between [*reading] the data and
+Sharable and upgradable mutex are special mutex types that offers more locking possibilities
+than a normal mutex. Sometimes, we can distinguish between [*reading] the data and
 [*modifying] the data. If just some threads need to modify the data, and a plain mutex
 is used to protect the data from concurrent access, concurrency is pretty limited:
 two threads that only read the data will be serialized instead of being executed
@@ -1735,20 +1750,21 @@
 concurrent access between threads that read and modify or between threads that modify,
 we can increase performance. This is specially true in applications where data reading
 is more common than data modification and the synchronized data reading code needs
-some time to execute. With an upgradable mutex we can acquire 3
-lock types:
+some time to execute. With a sharable mutex we can acquire 2 lock types:
 
 * [*Exclusive lock]: Similar to a plain mutex. If a thread acquires an exclusive
    lock, no other thread can acquire any lock (exclusive or other) until the exclusive
- lock is released. If any thread has a sharable or upgradable lock a thread trying
+ lock is released. If any thread other has any lock other than exclusive, a thread trying
    to acquire an exclusive lock will block.
    This lock will be acquired by threads that will modify the data.
 
 * [*Sharable lock]: If a thread acquires a sharable lock, other threads
- can acquire a sharable lock or an upgradable lock. If any thread has acquired
+ can't acquire the exclusive lock. If any thread has acquired
    the exclusive lock a thread trying to acquire a sharable lock will block.
    This locking is executed by threads that just need to read the data.
 
+With an upgradable mutex we can acquire previous locks plus a new upgradable lock:
+
 * [*Upgradable lock]: Acquiring an upgradable lock is similar to acquiring
    a [*privileged sharable lock]. If a thread acquires an upgradable lock, other threads
    can acquire a sharable lock. If any thread has acquired the exclusive or upgradable lock
@@ -1767,20 +1783,34 @@
 
 To sum up:
 
-[table Locking Possibilities
+[table Locking Possibilities for a Sharable Mutex
+ [[If a thread has acquired the...] [Other threads can acquire...]]
+ [[Sharable lock] [many sharable locks]]
+ [[Exclusive lock] [no locks]]
+]
+
+[table Locking Possibilities for an Upgradable Mutex
    [[If a thread has acquired the...] [Other threads can acquire...]]
    [[Sharable lock] [many sharable locks and 1 upgradable lock]]
    [[Upgradable lock] [many sharable locks]]
    [[Exclusive lock] [no locks]]
 ]
 
-A thread that has acquired a lock can try to acquire another lock type atomically.
+[endsect]
+
+[section:upgradable_transitions Lock transitions for Upgradable Mutex]
+
+A sharable mutex has no option to change the acquired lock for another lock
+atomically.
+
+On the other hand, for an upgradable mutex, a thread that has
+acquired a lock can try to acquire another lock type atomically.
 All lock transitions are not guaranteed to succeed. Even if a transition is guaranteed
 to succeed, some transitions will block the thread waiting until other threads release
 the sharable locks. [*Atomically] means that no other thread will acquire an Upgradable
 or Exclusive lock in the transition, [*so data is guaranteed to remain unchanged]:
 
-[table Transition Possibilities
+[table Transition Possibilities for an Upgradable Mutex
    [[If a thread has acquired the...] [It can atomically release the previous lock and...]]
    [[Sharable lock] [try to obtain (not guaranteed) immediately the Exclusive lock if no other thread has exclusive or upgrable lock]]
    [[Sharable lock] [try to obtain (not guaranteed) immediately the Upgradable lock if no other thread has exclusive or upgrable lock]]
@@ -1798,18 +1828,18 @@
 
 [endsect]
 
-[section:upgradable_mutexes_operations Upgradable Mutex Operations]
+[section:sharable_upgradable_mutexes_operations Upgradable Mutex Operations]
 
 All the upgradable mutex types from [*Boost.Interprocess] implement
 the following operations:
 
-[section:upgradable_mutexes_operations_exclusive Exclusive Locking]
+[section:sharable_upgradable_mutexes_operations_exclusive Exclusive Locking (Sharable & Upgradable Mutexes)]
 
 [blurb ['[*void lock()]]]
 
 [*Effects:]
 The calling thread tries to obtain exclusive ownership of the mutex, and if
-another thread has exclusive, sharable or upgradable ownership of the mutex,
+another thread has any ownership of the mutex (exclusive or other),
 it waits until it can obtain the ownership.
 
 [*Throws:] *interprocess_exception* on error.
@@ -1818,8 +1848,8 @@
 
 [*Effects:]
 The calling thread tries to acquire exclusive ownership of the mutex without
-waiting. If no other thread has exclusive, sharable or upgradable ownership of
-the mutex this succeeds.
+waiting. If no other thread has any ownership of the mutex (exclusive or other)
+this succeeds.
 
 [*Returns:] If it can acquire exclusive ownership immediately returns true.
 If it has to wait, returns false.
@@ -1830,8 +1860,8 @@
 
 [*Effects:]
 The calling thread tries to acquire exclusive ownership of the mutex
-waiting if necessary until no other thread has exclusive,
-sharable or upgradable ownership of the mutex or abs_time is reached.
+waiting if necessary until no other thread has any ownership of the mutex
+(exclusive or other) or abs_time is reached.
 
 [*Returns:] If acquires exclusive ownership, returns true. Otherwise
 returns false.
@@ -1848,7 +1878,7 @@
 
 [endsect]
 
-[section:upgradable_mutexes_operations_sharable Sharable Locking]
+[section:sharable_upgradable_mutexes_operations_sharable Sharable Locking (Sharable & Upgradable Mutexes)]
 
 [blurb ['[*void lock_sharable()]]]
 
@@ -1893,7 +1923,7 @@
 
 [endsect]
 
-[section:upgradable_mutexes_operations_upgradable Upgradable Locking]
+[section:upgradable_mutexes_operations_upgradable Upgradable Locking (Upgradable Mutex only)]
 
 [blurb ['[*void lock_upgradable()]]]
 
@@ -1938,7 +1968,7 @@
 
 [endsect]
 
-[section:upgradable_mutexes_operations_demotions Demotions]
+[section:upgradable_mutexes_operations_demotions Demotions (Upgradable Mutex only)]
 
 [blurb ['[*void unlock_and_lock_upgradable()]]]
 
@@ -1969,7 +1999,7 @@
 
 [endsect]
 
-[section:upgradable_mutexes_operations_promotions Promotions]
+[section:upgradable_mutexes_operations_promotions Promotions (Upgradable Mutex only)]
 [blurb ['[*void unlock_upgradable_and_lock()]]]
 
 [*Precondition:] The thread must have upgradable ownership of the mutex.
@@ -2031,7 +2061,25 @@
 
 [endsect]
 
-[section:upgradable_mutexes_mutex_interprocess_mutexes Boost.Interprocess Upgradable Mutex Types And Headers]
+[section:sharable_upgradable_mutexes_mutex_interprocess_mutexes Boost.Interprocess Sharable & Upgradable Mutex Types And Headers]
+
+Boost.Interprocess offers the following sharable mutex types:
+
+[c++]
+
+ #include <boost/interprocess/sync/interprocess_sharable_mutex.hpp>
+
+* [classref boost::interprocess::interprocess_sharable_mutex interprocess_sharable_mutex]: A non-recursive,
+ anonymous sharable mutex that can be placed in shared memory or memory mapped files.
+
+[c++]
+
+ #include <boost/interprocess/sync/named_sharable_mutex.hpp>
+
+* [classref boost::interprocess::named_sharable_mutex named_sharable_mutex]: A non-recursive,
+ named sharable mutex.
+
+[endsect]
 
 Boost.Interprocess offers the following upgradable mutex types:
 
@@ -2051,7 +2099,7 @@
 
 [endsect]
 
-[section:upgradable_mutexes_locks Sharable Lock And Upgradable Lock]
+[section:sharable_upgradable_locks Sharable Lock And Upgradable Lock]
 
 As with plain mutexes, it's important to release the acquired lock even in the presence
 of exceptions. [*Boost.Interprocess] mutexes are best used with the
@@ -2084,20 +2132,16 @@
 `sharable_lock` calls [*unlock_sharable()] in its destructor, and
 `upgradable_lock` calls [*unlock_upgradable()] in its destructor, so the
 upgradable mutex is always unlocked when an exception occurs.
-Scoped lock has many constructors to lock,
-try_lock, timed_lock a mutex or not to lock it at all.
-
 
 [c++]
 
    using namespace boost::interprocess;
 
- //Let's create any mutex type:
- MutexType mutex;
+ SharableOrUpgradableMutex sh_or_up_mutex;
 
    {
       //This will call lock_sharable()
- sharable_lock<MutexType> lock(mutex);
+ sharable_lock<SharableOrUpgradableMutex> lock(sh_or_up_mutex);
 
       //Some code
 
@@ -2106,7 +2150,7 @@
 
    {
       //This won't lock the mutex()
- sharable_lock<MutexType> lock(mutex, defer_lock);
+ sharable_lock<SharableOrUpgradableMutex> lock(sh_or_up_mutex, defer_lock);
 
       //Lock it on demand. This will call lock_sharable()
       lock.lock();
@@ -2118,7 +2162,7 @@
 
    {
       //This will call try_lock_sharable()
- sharable_lock<MutexType> lock(mutex, try_to_lock);
+ sharable_lock<SharableOrUpgradableMutex> lock(sh_or_up_mutex, try_to_lock);
 
       //Check if the mutex has been successfully locked
       if(lock){
@@ -2131,7 +2175,7 @@
       boost::posix_time::ptime abs_time = ...
 
       //This will call timed_lock_sharable()
- scoped_lock<MutexType> lock(mutex, abs_time);
+ scoped_lock<SharableOrUpgradableMutex> lock(sh_or_up_mutex, abs_time);
 
       //Check if the mutex has been successfully locked
       if(lock){
@@ -2140,9 +2184,11 @@
       //If the mutex was locked it will be unlocked
    }
 
+ UpgradableMutex up_mutex;
+
    {
       //This will call lock_upgradable()
- upgradable_lock<MutexType> lock(mutex);
+ upgradable_lock<UpgradableMutex> lock(up_mutex);
 
       //Some code
 
@@ -2151,7 +2197,7 @@
 
    {
       //This won't lock the mutex()
- upgradable_lock<MutexType> lock(mutex, defer_lock);
+ upgradable_lock<UpgradableMutex> lock(up_mutex, defer_lock);
 
       //Lock it on demand. This will call lock_upgradable()
       lock.lock();
@@ -2163,7 +2209,7 @@
 
    {
       //This will call try_lock_upgradable()
- upgradable_lock<MutexType> lock(mutex, try_to_lock);
+ upgradable_lock<UpgradableMutex> lock(up_mutex, try_to_lock);
 
       //Check if the mutex has been successfully locked
       if(lock){
@@ -2176,7 +2222,7 @@
       boost::posix_time::ptime abs_time = ...
 
       //This will call timed_lock_upgradable()
- scoped_lock<MutexType> lock(mutex, abs_time);
+ scoped_lock<UpgradableMutex> lock(up_mutex, abs_time);
 
       //Check if the mutex has been successfully locked
       if(lock){
@@ -6679,6 +6725,7 @@
    undefining macro `BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX` in `boost/interprocess/detail/workaround.hpp`
 * Improved `message_queue` insertion time avoiding priority search for common cases
    (both array and circular buffer configurations).
+* Implemented `sharable_mutex` and `interproces_condition_any`.
 
 [endsect]
 
@@ -6688,6 +6735,10 @@
 * Synchronous and asynchronous flushing for `mapped_region::flush`.
 * Source & ABI breaking: Removed `get_offset` method from `mapped_region` as
    it has no practical utility and `m_offset` member was not for anything else.
+* Source & ABI breaking: Removed `flush` from `managed_shared_memory`.
+ as it is unspecified according to POSIX:
+ [@http://pubs.opengroup.org/onlinepubs/009695399/functions/msync.html
+ ['"The effect of msync() on a shared memory object or a typed memory object is unspecified"] ].
 * Fixed bug
   [@https://svn.boost.org/trac/boost/ticket/7152 #7152],
 

Modified: trunk/libs/interprocess/proj/vc7ide/Interprocess.sln
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/Interprocess.sln (original)
+++ trunk/libs/interprocess/proj/vc7ide/Interprocess.sln 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -471,6 +471,14 @@
         ProjectSection(ProjectDependencies) = postProject
         EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "named_sharable_mutex_test", "named_sharable_mutex.vcproj", "{4FB82CC8-9671-FA47-48FE-723BA0D91604}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "named_condition_any_test", "named_condition_any_test.vcproj", "{58CC2563-6092-48FE-FAF7-BA046A792658}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
 Global
         GlobalSection(SolutionConfiguration) = preSolution
                 Debug = Debug
@@ -951,6 +959,14 @@
                 {5875E186-48F8-0992-26A7-D34F4A053798}.Debug.Build.0 = Debug|Win32
                 {5875E186-48F8-0992-26A7-D34F4A053798}.Release.ActiveCfg = Release|Win32
                 {5875E186-48F8-0992-26A7-D34F4A053798}.Release.Build.0 = Release|Win32
+ {4FB82CC8-9671-FA47-48FE-723BA0D91604}.Debug.ActiveCfg = Debug|Win32
+ {4FB82CC8-9671-FA47-48FE-723BA0D91604}.Debug.Build.0 = Debug|Win32
+ {4FB82CC8-9671-FA47-48FE-723BA0D91604}.Release.ActiveCfg = Release|Win32
+ {4FB82CC8-9671-FA47-48FE-723BA0D91604}.Release.Build.0 = Release|Win32
+ {58CC2563-6092-48FE-FAF7-BA046A792658}.Debug.ActiveCfg = Debug|Win32
+ {58CC2563-6092-48FE-FAF7-BA046A792658}.Debug.Build.0 = Debug|Win32
+ {58CC2563-6092-48FE-FAF7-BA046A792658}.Release.ActiveCfg = Release|Win32
+ {58CC2563-6092-48FE-FAF7-BA046A792658}.Release.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(ExtensibilityGlobals) = postSolution
         EndGlobalSection

Added: trunk/libs/interprocess/proj/vc7ide/condition_any_test.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/proj/vc7ide/condition_any_test.vcproj 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="condition_any_test"
+ ProjectGUID="{5875E186-48F8-0992-26A7-D34F4A053798}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Bin/Win32/Debug"
+ IntermediateDirectory="Debug/condition_any_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/condition_any_test_d.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/condition_any_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ FixedBaseAddress="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Bin/Win32/Release"
+ IntermediateDirectory="Release/condition_any_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/condition_any_test.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4F7FC731-C1A0-3276-A046-A8372F2A657F}">
+ <File
+ RelativePath="..\..\test\condition_any_test.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -195,6 +195,9 @@
                                 RelativePath="..\..\..\..\boost\interprocess\sync\interprocess_condition.hpp">
                         </File>
                         <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\interprocess_condition_any.hpp">
+ </File>
+ <File
                                 RelativePath="..\..\..\..\boost\interprocess\sync\interprocess_mutex.hpp">
                         </File>
                         <File
@@ -204,6 +207,9 @@
                                 RelativePath="..\..\..\..\boost\interprocess\sync\interprocess_semaphore.hpp">
                         </File>
                         <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\interprocess_sharable_mutex.hpp">
+ </File>
+ <File
                                 RelativePath="..\..\..\..\boost\interprocess\sync\interprocess_upgradable_mutex.hpp">
                         </File>
                         <File
@@ -216,6 +222,9 @@
                                 RelativePath="..\..\..\..\boost\interprocess\sync\named_condition.hpp">
                         </File>
                         <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\named_condition_any.hpp">
+ </File>
+ <File
                                 RelativePath="..\..\..\..\boost\interprocess\sync\named_mutex.hpp">
                         </File>
                         <File
@@ -225,6 +234,9 @@
                                 RelativePath="..\..\..\..\boost\interprocess\sync\named_semaphore.hpp">
                         </File>
                         <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\named_sharable_mutex.hpp">
+ </File>
+ <File
                                 RelativePath="..\..\..\..\boost\interprocess\sync\named_upgradable_mutex.hpp">
                         </File>
                         <File
@@ -312,6 +324,9 @@
                                         RelativePath="..\..\..\..\boost\interprocess\sync\windows\named_condition.hpp">
                                 </File>
                                 <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\windows\named_condition_any.hpp">
+ </File>
+ <File
                                         RelativePath="..\..\..\..\boost\interprocess\sync\windows\named_mutex.hpp">
                                 </File>
                                 <File
@@ -346,6 +361,9 @@
                                         RelativePath="..\..\..\..\boost\interprocess\sync\shm\named_condition.hpp">
                                 </File>
                                 <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\shm\named_condition_any.hpp">
+ </File>
+ <File
                                         RelativePath="..\..\..\..\boost\interprocess\sync\shm\named_creation_functor.hpp">
                                 </File>
                                 <File
@@ -367,6 +385,12 @@
                                 <File
                                         RelativePath="..\..\..\..\boost\interprocess\sync\detail\condition_algorithm_8a.hpp">
                                 </File>
+ <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\detail\condition_any_algorithm.hpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\interprocess\sync\detail\locks.hpp">
+ </File>
                         </Filter>
                 </Filter>
                 <Filter

Added: trunk/libs/interprocess/proj/vc7ide/named_condition_any_test.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/proj/vc7ide/named_condition_any_test.vcproj 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="named_condition_any_test"
+ ProjectGUID="{58CC2563-6092-48FE-FAF7-BA046A792658}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Bin/Win32/Debug"
+ IntermediateDirectory="Debug/named_condition_any_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/named_condition_any_test_d.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/named_condition_any_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ FixedBaseAddress="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Bin/Win32/Release"
+ IntermediateDirectory="Release/named_condition_any_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/named_condition_any_test.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{47CC37F1-4376-86CD-C329-09DAE27A552F}">
+ <File
+ RelativePath="..\..\test\named_condition_any_test.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: trunk/libs/interprocess/proj/vc7ide/named_sharable_mutex.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/proj/vc7ide/named_sharable_mutex.vcproj 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="named_sharable_mutex_test"
+ ProjectGUID="{4FB82CC8-9671-FA47-48FE-723BA0D91604}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Bin/Win32/Debug"
+ IntermediateDirectory="Debug/named_sharable_mutex_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/named_sharable_mutex_test_d.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/named_sharable_mutex_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ FixedBaseAddress="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Bin/Win32/Release"
+ IntermediateDirectory="Release/named_sharable_mutex_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/named_sharable_mutex_test.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4C9376F1-C9A1-60A6-4DC1-4F6D525F2354}">
+ <File
+ RelativePath="..\..\test\named_sharable_mutex_test.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: trunk/libs/interprocess/proj/vc7ide/sharable_mutex.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/proj/vc7ide/sharable_mutex.vcproj 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="sharable_mutex_test"
+ ProjectGUID="{4E88C1C2-0961-F7A4-F48E-A6A7D3B06004}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Bin/Win32/Debug"
+ IntermediateDirectory="Debug/sharable_mutex_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/sharable_mutex_test_d.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/sharable_mutex_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ FixedBaseAddress="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Bin/Win32/Release"
+ IntermediateDirectory="Release/sharable_mutex_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/sharable_mutex_test.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4F437FA1-7AC5-65A6-3734-02AD453552CF}">
+ <File
+ RelativePath="..\..\test\sharable_mutex_test.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Added: trunk/libs/interprocess/test/condition_any_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/test/condition_any_test.cpp 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,34 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/sync/interprocess_condition_any.hpp>
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
+#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
+#include <boost/interprocess/sync/spin/mutex.hpp>
+
+#include "condition_test_template.hpp"
+
+using namespace boost::interprocess;
+
+int main ()
+{
+ if(!test::do_test_condition<interprocess_condition_any, interprocess_mutex>())
+ return 1;
+ if(!test::do_test_condition<interprocess_condition_any, ipcdetail::spin_mutex>())
+ return 1;
+ if(!test::do_test_condition<interprocess_condition_any, interprocess_recursive_mutex>())
+ return 1;
+
+ return 0;
+}
+
+#include <boost/interprocess/detail/config_end.hpp>

Added: trunk/libs/interprocess/test/named_condition_any_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/test/named_condition_any_test.cpp 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,189 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/sync/named_mutex.hpp>
+#include <boost/interprocess/sync/named_condition_any.hpp>
+#include <boost/interprocess/sync/detail/locks.hpp>
+#include "condition_test_template.hpp"
+#include "named_creation_template.hpp"
+#include <string>
+#include <sstream>
+#include "get_process_id_name.hpp"
+
+using namespace boost::interprocess;
+
+struct condition_deleter
+{
+ std::string name;
+
+ ~condition_deleter()
+ {
+ if(name.empty())
+ named_condition_any::remove(test::add_to_process_id_name("named_condition_any"));
+ else
+ named_condition_any::remove(name.c_str());
+ }
+};
+
+inline std::string num_to_string(int n)
+{ std::stringstream s; s << n; return s.str(); }
+
+//This wrapper is necessary to have a default constructor
+//in generic mutex_test_template functions
+class named_condition_any_test_wrapper
+ : public condition_deleter, public named_condition_any
+{
+ public:
+
+ named_condition_any_test_wrapper()
+ : named_condition_any(open_or_create,
+ (test::add_to_process_id_name("test_cond") + num_to_string(count)).c_str())
+ {
+ condition_deleter::name += test::add_to_process_id_name("test_cond");
+ condition_deleter::name += num_to_string(count);
+ ++count;
+ }
+
+ ~named_condition_any_test_wrapper()
+ { --count; }
+
+
+ template <typename L>
+ void wait(L& lock)
+ {
+ ipcdetail::internal_mutex_lock<L> internal_lock(lock);
+ named_condition_any::wait(internal_lock);
+ }
+
+ template <typename L, typename Pr>
+ void wait(L& lock, Pr pred)
+ {
+ ipcdetail::internal_mutex_lock<L> internal_lock(lock);
+ named_condition_any::wait(internal_lock, pred);
+ }
+
+ template <typename L>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time)
+ {
+ ipcdetail::internal_mutex_lock<L> internal_lock(lock);
+ return named_condition_any::timed_wait(internal_lock, abs_time);
+ }
+
+ template <typename L, typename Pr>
+ bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
+ {
+ ipcdetail::internal_mutex_lock<L> internal_lock(lock);
+ return named_condition_any::timed_wait(internal_lock, abs_time, pred);
+ }
+
+ static int count;
+};
+
+int named_condition_any_test_wrapper::count = 0;
+
+//This wrapper is necessary to have a common constructor
+//in generic named_creation_template functions
+class named_condition_any_creation_test_wrapper
+ : public condition_deleter, public named_condition_any
+{
+ public:
+ named_condition_any_creation_test_wrapper(create_only_t)
+ : named_condition_any(create_only, test::add_to_process_id_name("named_condition_any"))
+ { ++count_; }
+
+ named_condition_any_creation_test_wrapper(open_only_t)
+ : named_condition_any(open_only, test::add_to_process_id_name("named_condition_any"))
+ { ++count_; }
+
+ named_condition_any_creation_test_wrapper(open_or_create_t)
+ : named_condition_any(open_or_create, test::add_to_process_id_name("named_condition_any"))
+ { ++count_; }
+
+ ~named_condition_any_creation_test_wrapper() {
+ if(--count_){
+ ipcdetail::interprocess_tester::
+ dont_close_on_destruction(static_cast<named_condition_any&>(*this));
+ }
+ }
+ static int count_;
+};
+
+int named_condition_any_creation_test_wrapper::count_ = 0;
+
+struct mutex_deleter
+{
+ std::string name;
+
+ ~mutex_deleter()
+ {
+ if(name.empty())
+ named_mutex::remove(test::add_to_process_id_name("named_mutex"));
+ else
+ named_mutex::remove(name.c_str());
+ }
+};
+
+//This wrapper is necessary to have a default constructor
+//in generic mutex_test_template functions
+class named_mutex_test_wrapper
+ : public mutex_deleter, public named_mutex
+{
+ public:
+ named_mutex_test_wrapper()
+ : named_mutex(open_or_create,
+ (test::add_to_process_id_name("test_mutex") + num_to_string(count)).c_str())
+ {
+ mutex_deleter::name += test::add_to_process_id_name("test_mutex");
+ mutex_deleter::name += num_to_string(count);
+ ++count;
+ }
+
+ typedef named_mutex internal_mutex_type;
+
+ internal_mutex_type &internal_mutex()
+ { return *this; }
+
+ ~named_mutex_test_wrapper()
+ { --count; }
+
+ static int count;
+};
+
+int named_mutex_test_wrapper::count = 0;
+
+int main ()
+{
+ try{
+ //Remove previous mutexes and conditions
+ named_mutex::remove(test::add_to_process_id_name("test_mutex0"));
+ named_condition_any::remove(test::add_to_process_id_name("test_cond0"));
+ named_condition_any::remove(test::add_to_process_id_name("test_cond1"));
+ named_condition_any::remove(test::add_to_process_id_name("named_condition_any"));
+ named_mutex::remove(test::add_to_process_id_name("named_mutex"));
+
+ test::test_named_creation<named_condition_any_creation_test_wrapper>();
+ test::do_test_condition<named_condition_any_test_wrapper
+ ,named_mutex_test_wrapper>();
+ }
+ catch(std::exception &ex){
+ std::cout << ex.what() << std::endl;
+ return 1;
+ }
+ named_mutex::remove(test::add_to_process_id_name("test_mutex0"));
+ named_condition_any::remove(test::add_to_process_id_name("test_cond0"));
+ named_condition_any::remove(test::add_to_process_id_name("test_cond1"));
+ named_condition_any::remove(test::add_to_process_id_name("named_condition_any"));
+ named_mutex::remove(test::add_to_process_id_name("named_mutex"));
+ return 0;
+}
+
+#include <boost/interprocess/detail/config_end.hpp>

Added: trunk/libs/interprocess/test/named_sharable_mutex_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/test/named_sharable_mutex_test.cpp 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,103 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include "mutex_test_template.hpp"
+#include "sharable_mutex_test_template.hpp"
+#include "named_creation_template.hpp"
+#include <boost/interprocess/sync/named_sharable_mutex.hpp>
+#include <string>
+#include "get_process_id_name.hpp"
+
+using namespace boost::interprocess;
+
+struct mutex_deleter
+{
+ ~mutex_deleter()
+ { named_sharable_mutex::remove(test::get_process_id_name()); }
+};
+
+//This wrapper is necessary to have a default constructor
+//in generic mutex_test_template functions
+class named_sharable_mutex_lock_test_wrapper
+ : public named_sharable_mutex
+{
+ public:
+ named_sharable_mutex_lock_test_wrapper()
+ : named_sharable_mutex(open_or_create, test::get_process_id_name())
+ { ++count_; }
+
+ ~named_sharable_mutex_lock_test_wrapper()
+ {
+ if(--count_){
+ ipcdetail::interprocess_tester::
+ dont_close_on_destruction(static_cast<named_sharable_mutex&>(*this));
+ }
+ }
+
+ static int count_;
+};
+
+int named_sharable_mutex_lock_test_wrapper::count_ = 0;
+
+
+//This wrapper is necessary to have a common constructor
+//in generic named_creation_template functions
+class named_sharable_mutex_creation_test_wrapper
+ : public mutex_deleter, public named_sharable_mutex
+{
+ public:
+ named_sharable_mutex_creation_test_wrapper
+ (create_only_t)
+ : named_sharable_mutex(create_only, test::get_process_id_name())
+ { ++count_; }
+
+ named_sharable_mutex_creation_test_wrapper
+ (open_only_t)
+ : named_sharable_mutex(open_only, test::get_process_id_name())
+ { ++count_; }
+
+ named_sharable_mutex_creation_test_wrapper
+ (open_or_create_t)
+ : named_sharable_mutex(open_or_create, test::get_process_id_name())
+ { ++count_; }
+
+ ~named_sharable_mutex_creation_test_wrapper()
+ {
+ if(--count_){
+ ipcdetail::interprocess_tester::
+ dont_close_on_destruction(static_cast<named_sharable_mutex&>(*this));
+ }
+ }
+
+ static int count_;
+};
+
+int named_sharable_mutex_creation_test_wrapper::count_ = 0;
+
+int main ()
+{
+ try{
+ named_sharable_mutex::remove(test::get_process_id_name());
+ test::test_named_creation< test::named_sync_creation_test_wrapper<named_sharable_mutex> >();
+ test::test_all_lock< test::named_sync_wrapper<named_sharable_mutex> >();
+ test::test_all_mutex<test::named_sync_wrapper<named_sharable_mutex> >();
+ test::test_all_sharable_mutex<test::named_sync_wrapper<named_sharable_mutex> >();
+ }
+ catch(std::exception &ex){
+ named_sharable_mutex::remove(test::get_process_id_name());
+ std::cout << ex.what() << std::endl;
+ return 1;
+ }
+ named_sharable_mutex::remove(test::get_process_id_name());
+ return 0;
+}
+
+#include <boost/interprocess/detail/config_end.hpp>

Added: trunk/libs/interprocess/test/sharable_mutex_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/test/sharable_mutex_test.cpp 2012-08-22 17:03:28 EDT (Wed, 22 Aug 2012)
@@ -0,0 +1,31 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include "mutex_test_template.hpp"
+#include "sharable_mutex_test_template.hpp"
+#include <boost/interprocess/sync/interprocess_sharable_mutex.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/interprocess/sync/sharable_lock.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include "util.hpp"
+
+int main ()
+{
+ using namespace boost::interprocess;
+
+ test::test_all_lock<interprocess_sharable_mutex>();
+ test::test_all_mutex<interprocess_sharable_mutex>();
+ test::test_all_sharable_mutex<interprocess_sharable_mutex>();
+
+ return 0;
+}
+
+#include <boost/interprocess/detail/config_end.hpp>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk