Added thread-safety

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@730 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2014-05-20 05:56:27 +00:00
parent f1580c95cc
commit 086a42e432
15 changed files with 464 additions and 12 deletions

View file

@ -144,4 +144,14 @@ The policy can then be activated by defining MOCK_ERROR_POLICY prior to includin
[endsect]
[section Thread safety]
Thread safety is not activated by default however defining MOCK_THREAD_SAFE before including the library will make creations and calls to mock objects thread-safe :
[thread_safe]
If available the library will rely on the C++11 standard mutexes and locks, otherwise Boost.Thread will be used.
[endsect]
[endsect]

View file

@ -171,3 +171,8 @@ struct custom_policy
#define MOCK_ERROR_POLICY custom_policy
#include <turtle/mock.hpp>
//]
//[ thread_safe
#define MOCK_THREAD_SAFE
#include <turtle/mock.hpp>
//]

View file

@ -39,6 +39,9 @@
<build-turtle-test name="turtle_no_variadic_macros">
<defineset define="MOCK_NO_VARIADIC_MACROS"/>
</build-turtle-test>
<build-turtle-test name="turtle_thread_safe">
<defineset define="MOCK_THREAD_SAFE"/>
</build-turtle-test>
</target>
<target name="analyse" description="run errors analyser">

View file

@ -39,6 +39,7 @@
<ClInclude Include="..\..\turtle\detail\is_functor.hpp" />
<ClInclude Include="..\..\turtle\detail\lambda.hpp" />
<ClInclude Include="..\..\turtle\detail\matcher_base.hpp" />
<ClInclude Include="..\..\turtle\detail\mutex.hpp" />
<ClInclude Include="..\..\turtle\detail\object_impl.hpp" />
<ClInclude Include="..\..\turtle\detail\parameter.hpp" />
<ClInclude Include="..\..\turtle\detail\parent.hpp" />

View file

@ -127,5 +127,8 @@
<ClInclude Include="..\..\turtle\detail\addressof.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\mutex.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
</ItemGroup>
</Project>