Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
GlibThreadImplementation.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/* GlibThreadImplementation.h (C) 2000-2026 */
9/* */
10/* Implementation of ITreadImplementation with '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 Arcane
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
35class ARCCORE_CONCURRENCY_EXPORT GlibThreadImplementation
38{
40
41 public:
42
43 GlibThreadImplementation();
44 ~GlibThreadImplementation() override;
45
46 public:
47
48 void initialize() override;
49
50 public:
51
52 ThreadImpl* createThread(IFunctor* f) override;
53 void joinThread(ThreadImpl* t) override;
54 void destroyThread(ThreadImpl* t) override;
55
56 void createSpinLock(Int64* spin_lock_addr) override;
57 void lockSpinLock(Int64* spin_lock_addr, Int64* scoped_spin_lock_addr) override;
58 void unlockSpinLock(Int64* spin_lock_addr, Int64* scoped_spin_lock_addr) override;
59
60 MutexImpl* createMutex() override;
61 void destroyMutex(MutexImpl*) override;
62 void lockMutex(MutexImpl* mutex) override;
63 void unlockMutex(MutexImpl* mutex) override;
64
65 Int64 currentThread() override;
66
67 IThreadBarrier* createBarrier() override;
68
69 public:
70
71 void addReference() override { ReferenceCounterImpl::_internalAddReference(); }
72 void removeReference() override { ReferenceCounterImpl::_internalRemoveReference(); }
73
74 private:
75
76 MutexImpl* m_global_mutex_impl;
77};
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82} // namespace Arcane
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87#endif
#define ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to define methods managing counters of references.
Thread-safe implementation of a reference counter.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.