lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
include
LmmsSemaphore.h
Go to the documentation of this file.
1
/*
2
* Semaphore.h - Semaphore declaration
3
*
4
* Copyright (c) 2022-2022 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
5
*
6
* This file is part of LMMS - https://lmms.io
7
*
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public
19
* License along with this program (see COPYING); if not, write to the
20
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
* Boston, MA 02110-1301 USA.
22
*
23
*/
24
25
/*
26
* This code has been copied and adapted from https://github.com/drobilla/jalv
27
* File src/zix/sem.h
28
*/
29
30
#ifndef LMMS_SEMAPHORE_H
31
#define LMMS_SEMAPHORE_H
32
33
#include "lmmsconfig.h"
34
35
#ifdef LMMS_BUILD_APPLE
36
# include <mach/mach.h>
37
#elif defined(LMMS_BUILD_WIN32)
38
# include <windows.h>
39
#else
40
# include <semaphore.h>
41
#endif
42
43
44
namespace
lmms
{
45
66
class
Semaphore
67
{
68
public
:
69
Semaphore
(
unsigned
initial);
70
Semaphore
(
const
Semaphore
&) =
delete
;
71
Semaphore
&
operator=
(
const
Semaphore
&) =
delete
;
72
Semaphore
(
Semaphore
&&) =
delete
;
73
Semaphore
&
operator=
(
Semaphore
&&) =
delete
;
74
~Semaphore
();
75
76
void
post
();
77
void
wait
();
78
bool
tryWait
();
79
80
private
:
81
#ifdef LMMS_BUILD_APPLE
82
semaphore_t
m_sem
;
83
#elif defined(LMMS_BUILD_WIN32)
84
HANDLE
m_sem
;
85
#else
86
sem_t
m_sem
;
87
#endif
88
};
89
90
}
// namespace lmms
91
92
#endif
// LMMS_SEMAPHORE_H
lmms::Semaphore::Semaphore
Semaphore(Semaphore &&)=delete
lmms::Semaphore::Semaphore
Semaphore(const Semaphore &)=delete
lmms::Semaphore::operator=
Semaphore & operator=(const Semaphore &)=delete
lmms::Semaphore::Semaphore
Semaphore(unsigned initial)
Definition
LmmsSemaphore.cpp:108
lmms::Semaphore::m_sem
sem_t m_sem
Definition
LmmsSemaphore.h:86
lmms::Semaphore::wait
void wait()
Definition
LmmsSemaphore.cpp:125
lmms::Semaphore::tryWait
bool tryWait()
Definition
LmmsSemaphore.cpp:135
lmms::Semaphore::post
void post()
Definition
LmmsSemaphore.cpp:120
lmms::Semaphore::operator=
Semaphore & operator=(Semaphore &&)=delete
lmms
Definition
RemotePluginBase.cpp:34
Generated on
for lmms by
1.18.0