Mercurial > hg > orthanc
comparison OrthancFramework/Sources/MultiThreading/Mutex.h @ 5398:08b5516c6e5e
compatibility of OrthancFramework with latest releases of Emscripten
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 11 Oct 2023 15:26:45 +0200 |
parents | |
children | 48b8dae6dc77 |
comparison
equal
deleted
inserted
replaced
5397:e7f6ec8cbc35 | 5398:08b5516c6e5e |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium | |
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
7 * | |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU Lesser General Public License | |
10 * as published by the Free Software Foundation, either version 3 of | |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
19 * License along with this program. If not, see | |
20 * <http://www.gnu.org/licenses/>. | |
21 **/ | |
22 | |
23 | |
24 #pragma once | |
25 | |
26 #if !defined(__EMSCRIPTEN__) | |
27 # include <boost/thread/mutex.hpp> | |
28 #endif | |
29 | |
30 namespace Orthanc | |
31 { | |
32 // Wrapper class for compatibility with Emscripten | |
33 | |
34 #if defined(__EMSCRIPTEN__) | |
35 | |
36 class ORTHANC_PUBLIC Mutex : public boost::noncopyable | |
37 { | |
38 public: | |
39 class ORTHANC_PUBLIC ScopedLock : public boost::noncopyable | |
40 { | |
41 public: | |
42 explicit ScopedLock(Mutex& mutex) | |
43 { | |
44 } | |
45 }; | |
46 }; | |
47 | |
48 #else | |
49 | |
50 class ORTHANC_PUBLIC Mutex : public boost::noncopyable | |
51 { | |
52 private: | |
53 boost::mutex mutex_; | |
54 | |
55 public: | |
56 class ORTHANC_PUBLIC ScopedLock : public boost::noncopyable | |
57 { | |
58 private: | |
59 boost::mutex::scoped_lock lock_; | |
60 | |
61 public: | |
62 explicit ScopedLock(Mutex& mutex) : | |
63 lock_(mutex.mutex_) | |
64 { | |
65 } | |
66 }; | |
67 }; | |
68 #endif | |
69 } |