Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
GlibThreadImplementation.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* GlibThreadImplementation.h (C) 2000-2024 */
9/* */
10/* Implémentation de ITreadImplementation avec la 'Glib'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_CONCURRENCY_GLIBTHREADIMPLEMENTATION_H
13#define ARCCORE_CONCURRENCY_GLIBTHREADIMPLEMENTATION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/concurrency/IThreadImplementation.h"
18
20
21#include <atomic>
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arccore
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31/*!
32 * \brief Implémentation de ITreadImplementation avec la 'Glib'.
33 */
34class ARCCORE_CONCURRENCY_EXPORT GlibThreadImplementation
37{
39
40 public:
41
44
45 public:
46
47 void initialize() override;
48
49 public:
50
51 ThreadImpl* createThread(IFunctor* f) override;
52 void joinThread(ThreadImpl* t) override;
53 void destroyThread(ThreadImpl* t) override;
54
55 void createSpinLock(Int64* spin_lock_addr) override;
56 void lockSpinLock(Int64* spin_lock_addr, Int64* scoped_spin_lock_addr) override;
57 void unlockSpinLock(Int64* spin_lock_addr, Int64* scoped_spin_lock_addr) override;
58
59 MutexImpl* createMutex() override;
60 void destroyMutex(MutexImpl*) override;
61 void lockMutex(MutexImpl* mutex) override;
62 void unlockMutex(MutexImpl* mutex) override;
63
64 Int64 currentThread() override;
65
66 IThreadBarrier* createBarrier() override;
67
68 public:
69
70 void addReference() override { ReferenceCounterImpl::addReference(); }
71 void removeReference() override { ReferenceCounterImpl::removeReference(); }
72
73 private:
74
75 MutexImpl* m_global_mutex_impl;
76};
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
80
81} // End namespace Arccore
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
85
86#endif
#define ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro pour définir les méthodes gérant les compteurs de référence.
Implémentation de ITreadImplementation avec la 'Glib'.
Interface d'un service implémentant le support des threads.
Implémentation thread-safe d'un compteur de référence.
Espace de nom de Arccore.
Definition ArcaneTypes.h:24
std::int64_t Int64
Type entier signé sur 64 bits.