Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/infra/RWMonitor.cpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2016 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#include "infra/RWMonitor.hpp"
24
#include "j9cfg.h"
25
#include "j9thread.h"
26
#include "j9port.h"
27
28
#ifdef J9VM_JIT_CLASS_UNLOAD_RWMONITOR
29
void
30
J9::RWMonitor::enter_read()
31
{
32
j9thread_rwmutex_enter_read(_monitor);
33
}
34
35
36
void
37
J9::RWMonitor::enter_write()
38
{
39
j9thread_rwmutex_enter_write(_monitor);
40
}
41
42
43
void
44
J9::RWMonitor::exit_read()
45
{
46
j9thread_rwmutex_exit_read(_monitor);
47
}
48
49
50
void
51
J9::RWMonitor::exit_write()
52
{
53
j9thread_rwmutex_exit_write(_monitor);
54
}
55
56
57
void
58
J9::RWMonitor::destroy()
59
{
60
j9thread_rwmutex_destroy(_monitor);
61
}
62
63
64
bool
65
J9::RWMonitor::init(char *name)
66
{
67
return j9thread_rwmutex_init(&_monitor, 0, name) == 0 ? true : false;
68
}
69
70
71
bool
72
J9::RWMonitor::initFromVMMutex(void *mutex)
73
{
74
_monitor = (RWMutex*)mutex;
75
return true;
76
}
77
78
#else
79
80
void
81
J9::RWMonitor::enter_read()
82
{
83
j9thread_monitor_enter(_monitor);
84
}
85
86
87
void
88
J9::RWMonitor::enter_write()
89
{
90
j9thread_monitor_enter(_monitor);
91
}
92
93
94
void
95
J9::RWMonitor::exit_read()
96
{
97
j9thread_monitor_exit(_monitor);
98
}
99
100
101
void
102
J9::RWMonitor::exit_write()
103
{
104
j9thread_monitor_exit(_monitor);
105
}
106
107
108
void
109
J9::RWMonitor::destroy()
110
{
111
j9thread_monitor_destroy(_monitor);
112
}
113
114
115
bool
116
J9::RWMonitor::init(char *name)
117
{
118
return j9thread_monitor_init_with_name((J9ThreadMonitor**)&_monitor, 0, name) == 0 ? true : false;
119
}
120
121
122
bool
123
J9::RWMonitor::initFromVMMutex(void *mutex)
124
{
125
_monitor = (J9ThreadMonitor*)mutex; return true;
126
}
127
128
#endif
129
130