Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
CriticalSection.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* CriticalSection.h (C) 2000-2008 */
9/* */
10/* Critical section in multi-thread. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_CRITICALSECTION_H
13#define ARCANE_UTILS_CRITICALSECTION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/IThreadMng.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
31class ARCANE_UTILS_EXPORT CriticalSection
32{
33 public:
34
35 CriticalSection(IThreadMng* tm)
36 : m_thread_mng(tm)
37 {
38 m_thread_mng->beginCriticalSection();
39 }
40 ~CriticalSection()
41 {
42 m_thread_mng->endCriticalSection();
43 }
44
45 private:
46
47 IThreadMng* m_thread_mng;
48};
49
50/*---------------------------------------------------------------------------*/
51/*---------------------------------------------------------------------------*/
52
53} // namespace Arcane
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58#endif
Interface of a thread manager.
Definition IThreadMng.h:32
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --