comparison UnitTestsSources/MultiThreadingTests.cpp @ 2567:3caca43371f5 jobs

archival of BagOfTasksProcessor, Mutex, and ReaderWriterLock
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 07 May 2018 14:26:31 +0200
parents c09ce3c038fc
children a46094602346
comparison
equal deleted inserted replaced
2566:c09ce3c038fc 2567:3caca43371f5
37 #include "../OrthancServer/Scheduler/ServerScheduler.h" 37 #include "../OrthancServer/Scheduler/ServerScheduler.h"
38 #include "../Core/OrthancException.h" 38 #include "../Core/OrthancException.h"
39 #include "../Core/SystemToolbox.h" 39 #include "../Core/SystemToolbox.h"
40 #include "../Core/Toolbox.h" 40 #include "../Core/Toolbox.h"
41 #include "../Core/MultiThreading/Locker.h" 41 #include "../Core/MultiThreading/Locker.h"
42 #include "../Core/MultiThreading/Mutex.h"
43 #include "../Core/MultiThreading/ReaderWriterLock.h"
44 42
45 using namespace Orthanc; 43 using namespace Orthanc;
46 44
47 namespace 45 namespace
48 { 46 {
103 catch (OrthancException&) 101 catch (OrthancException&)
104 { 102 {
105 } 103 }
106 } 104 }
107 105
108
109 TEST(MultiThreading, Mutex)
110 {
111 Mutex mutex;
112 Locker locker(mutex);
113 }
114
115
116 TEST(MultiThreading, ReaderWriterLock)
117 {
118 ReaderWriterLock lock;
119
120 {
121 Locker locker1(lock.ForReader());
122 Locker locker2(lock.ForReader());
123 }
124
125 {
126 Locker locker3(lock.ForWriter());
127 }
128 }
129 106
130 107
131 108
132 #include "../Core/DicomNetworking/ReusableDicomUserConnection.h" 109 #include "../Core/DicomNetworking/ReusableDicomUserConnection.h"
133 110