tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_Semaphore.cpp
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11#pragma once
12
13#include "../3rd_party/concurrentqueue.h"
14#include "../3rd_party/lightweightsemaphore.h"
15
16namespace tracktion { inline namespace graph
17{
18
19//==============================================================================
20//==============================================================================
21Semaphore::Semaphore (int initialCount)
22{
24}
25
29
31{
32 return pimpl->wait();
33}
34
36{
37 return pimpl->try_wait();
38}
39
41{
42 return pimpl->timed_wait (usecs);
43}
44
45void Semaphore::signal (int count)
46{
47 return pimpl->signal (count);
48}
49
50
51//==============================================================================
52//==============================================================================
57
61
63{
64 return pimpl->wait();
65}
66
68{
69 return pimpl->tryWait();
70}
71
73{
74 return pimpl->wait ((std::int64_t) usecs);
75}
76
78{
79 return pimpl->signal (count);
80}
81
82}} // namespace tracktion_engine
bool wait()
Decrements the count by one and if the result of this goes below zero the call will block.
bool timed_wait(std::uint64_t usecs)
Performs a wait operation.
bool try_wait()
Attemps to decrement the count by one.
void signal(int count=1)
Increases the count by the ammount specified.
LightweightSemaphore(int initialCount=0)
Creates a semaphore with an initial count.
bool try_wait()
Attemps to decrement the count by one.
void signal(int count=1)
Increases the count by the ammount specified.
bool timed_wait(std::uint64_t usecs)
Performs a wait operation.
Semaphore(int initialCount=0)
Creates a semaphore with an initial count.
bool wait()
Decrements the count by one and if the result of this goes below zero the call will block.
T is_pointer_v