annotate OrthancFramework/Sources/MultiThreading/Mutex.h @ 5818:86cd21ef81fb default

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