Arcane  v3.16.0.0
Documentation utilisateur
Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros Groupes Pages Concepts
GlibAdapter.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* GlibAdapter.h (C) 2000-2025 */
9/* */
10/* Classes utilitaires pour s'adapter aux différentes versions de la 'glib'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_CONCURRENCY_GLIBADAPTER_H
13#define ARCCORE_CONCURRENCY_GLIBADAPTER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/concurrency/ConcurrencyGlobal.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25class GlibCond;
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29/*!
30 * \internal
31 * \brief Encapsule un GMutex de la glib.
32 */
33class ARCCORE_CONCURRENCY_EXPORT GlibMutex
34{
35 friend class GlibCond;
36
37 public:
38
39 class Impl;
40
41 public:
42
43 class Lock
44 {
45 public:
46
47 Lock(GlibMutex& x);
48 ~Lock();
49 Lock() = delete;
50 Lock(const Lock&) = delete;
51 void operator=(const Lock&) = delete;
52
53 private:
54
55 Impl* m_mutex;
56 };
57
58 public:
59
60 GlibMutex() ARCCORE_NOEXCEPT;
61 ~GlibMutex();
62
63 public:
64
65 void lock();
66 void unlock();
67
68 private:
69
70 Impl* m_p = nullptr;
71};
72
73/*---------------------------------------------------------------------------*/
74/*---------------------------------------------------------------------------*/
75/*!
76 * \internal
77 * \brief Encapsule un GPrivate de la glib.
78 */
79class ARCCORE_CONCURRENCY_EXPORT GlibPrivate
80{
81 public:
82
83 class Impl;
84
85 public:
86
87 GlibPrivate();
88 ~GlibPrivate();
89 void create();
90 void setValue(void* value);
91 void* getValue();
92
93 private:
94
95 Impl* m_p = nullptr;
96};
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100/*!
101 * \internal
102 * \brief Encapsule un GCond de la glib.
103 */
104class ARCCORE_CONCURRENCY_EXPORT GlibCond
105{
106 public:
107
108 class Impl;
109
110 public:
111
112 GlibCond();
113 ~GlibCond();
114 void broadcast();
115 void wait(GlibMutex* mutex);
116
117 private:
118
119 Impl* m_p = nullptr;
120};
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
124
125} // namespace Arcane
126
127/*---------------------------------------------------------------------------*/
128/*---------------------------------------------------------------------------*/
129
130#endif
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-