Mercurial > hg > orthanc
comparison Core/MultiThreading/Semaphore.h @ 2108:68510b1c2433
Semaphore::Locker
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 22 Oct 2016 18:22:18 +0200 |
parents | b1291df2f780 |
children | 29689b30f9ae |
comparison
equal
deleted
inserted
replaced
2107:88831c3edd8f | 2108:68510b1c2433 |
---|---|
48 explicit Semaphore(unsigned int count); | 48 explicit Semaphore(unsigned int count); |
49 | 49 |
50 void Release(); | 50 void Release(); |
51 | 51 |
52 void Acquire(); | 52 void Acquire(); |
53 | |
54 class Locker : public boost::noncopyable | |
55 { | |
56 private: | |
57 Semaphore& that_; | |
58 | |
59 public: | |
60 Locker(Semaphore& that) : | |
61 that_(that) | |
62 { | |
63 that_.Acquire(); | |
64 } | |
65 | |
66 ~Locker() | |
67 { | |
68 that_.Release(); | |
69 } | |
70 }; | |
53 }; | 71 }; |
54 } | 72 } |