The Pedigree Project
0.1
src
system
include
pedigree
kernel
process
Mutex.h
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
20
#ifndef MUTEX_H
21
#define MUTEX_H
22
#include <config.h>
23
24
#ifdef STANDALONE_MUTEXES
25
26
#include "pedigree/kernel/processor/types.h"
27
28
class
Mutex
{
29
public
:
30
Mutex
();
31
Mutex
(
bool
) =
delete
;
32
~Mutex
();
33
34
bool
acquire
();
35
bool
tryAcquire
();
36
void
release
();
37
38
ssize_t
getValue
();
39
40
void
* getPrivate()
const
{
41
return
m_Private;
42
}
43
44
private
:
45
void
* m_Private;
46
};
47
48
#else
49
50
#if THREADS
51
52
#include "pedigree/kernel/compiler.h"
53
#include "pedigree/kernel/process/Semaphore.h"
54
56
class
EXPORTED_PUBLIC
Mutex
:
public
Semaphore
{
57
public
:
59
Mutex
();
60
Mutex
(
bool
) =
delete
;
62
~Mutex
();
63
65
bool
isOwnedByCurrentThread()
const
;
66
};
67
68
#endif
// THREADS
69
70
#endif
// STANDALONE_MUTEXES
71
72
#endif
// MUTEX_H
Mutex
Definition
Mutex.h:56
Mutex::Mutex
Mutex()
Definition
Mutex.cc:22
Mutex::~Mutex
~Mutex()
Definition
Mutex.cc:26
Semaphore
Definition
Semaphore.h:36
Semaphore::getValue
ssize_t getValue()
Definition
Semaphore.cc:598
Semaphore::release
void release(size_t n=1)
Definition
Semaphore.cc:546
Semaphore::tryAcquire
bool tryAcquire(size_t n=1)
Definition
Semaphore.cc:481
Semaphore::acquire
bool acquire(size_t n=1, size_t timeoutSecs=0, size_t timeoutUsecs=0)
Definition
Semaphore.cc:352
Generated on Thu Sep 24 2026 06:24:01 for The Pedigree Project by
1.9.8