Alexandria
2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
AlexandriaKernel
src
lib
Semaphore.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2012-2021 Euclid Science Ground Segment
3
*
4
* This library is free software; you can redistribute it and/or modify it under
5
* the terms of the GNU Lesser General Public License as published by the Free
6
* Software Foundation; either version 3.0 of the License, or (at your option)
7
* any later version.
8
*
9
* This library is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12
* details.
13
*
14
* You should have received a copy of the GNU Lesser General Public License
15
* along with this library; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#include "
AlexandriaKernel/Semaphore.h
"
20
#ifdef __APPLE__
21
#include "
SemaphoreMach.icpp
"
22
#else
23
#include "
SemaphorePosix.icpp
"
24
#endif
25
26
namespace
Euclid
{
27
28
Semaphore::Semaphore
(
unsigned
int
i) : m_impl(new SemaphoreImpl(i)) {}
29
30
Semaphore::~Semaphore
() =
default
;
31
32
void
Semaphore::release
() {
33
m_impl
->post();
34
}
35
36
void
Semaphore::acquire
() {
37
m_impl
->wait();
38
}
39
40
bool
Semaphore::try_acquire
() {
41
return
m_impl
->try_acquire();
42
}
43
44
bool
Semaphore::try_acquire_until
(
const
std::chrono::system_clock::time_point& abs_time) {
45
return
m_impl
->try_acquire_until(abs_time);
46
}
47
48
}
// namespace Euclid
SemaphoreMach.icpp
SemaphorePosix.icpp
Semaphore.h
Euclid::Semaphore::Semaphore
Semaphore(unsigned int i)
Definition
Semaphore.cpp:28
Euclid::Semaphore::~Semaphore
~Semaphore()
Euclid::Semaphore::acquire
void acquire()
Definition
Semaphore.cpp:36
Euclid::Semaphore::try_acquire_until
bool try_acquire_until(const std::chrono::system_clock::time_point &abs_time)
Definition
Semaphore.cpp:44
Euclid::Semaphore::release
void release()
Definition
Semaphore.cpp:32
Euclid::Semaphore::m_impl
std::unique_ptr< SemaphoreImpl > m_impl
Definition
Semaphore.h:100
Euclid::Semaphore::try_acquire
bool try_acquire()
Definition
Semaphore.cpp:40
Euclid
Definition
index_sequence.h:27
Generated by
1.9.8