Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/os/posix/os_posix.inline.hpp
40930 views
1
/*
2
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef OS_POSIX_OS_POSIX_INLINE_HPP
26
#define OS_POSIX_OS_POSIX_INLINE_HPP
27
28
// os_posix.hpp included by os.hpp
29
30
#include "runtime/os.hpp"
31
32
#include <unistd.h>
33
#include <sys/socket.h>
34
#include <netdb.h>
35
36
// macros for restartable system calls
37
38
#define RESTARTABLE(_cmd, _result) do { \
39
_result = _cmd; \
40
} while(((int)_result == OS_ERR) && (errno == EINTR))
41
42
#define RESTARTABLE_RETURN_INT(_cmd) do { \
43
int _result; \
44
RESTARTABLE(_cmd, _result); \
45
return _result; \
46
} while(false)
47
48
// Aix does not have NUMA support but need these for compilation.
49
inline bool os::numa_has_static_binding() { AIX_ONLY(ShouldNotReachHere();) return true; }
50
inline bool os::numa_has_group_homing() { AIX_ONLY(ShouldNotReachHere();) return false; }
51
52
// Platform Mutex/Monitor implementation
53
54
inline void os::PlatformMutex::lock() {
55
int status = pthread_mutex_lock(mutex());
56
assert_status(status == 0, status, "mutex_lock");
57
}
58
59
inline void os::PlatformMutex::unlock() {
60
int status = pthread_mutex_unlock(mutex());
61
assert_status(status == 0, status, "mutex_unlock");
62
}
63
64
inline bool os::PlatformMutex::try_lock() {
65
int status = pthread_mutex_trylock(mutex());
66
assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
67
return status == 0;
68
}
69
70
inline void os::PlatformMonitor::notify() {
71
int status = pthread_cond_signal(cond());
72
assert_status(status == 0, status, "cond_signal");
73
}
74
75
inline void os::PlatformMonitor::notify_all() {
76
int status = pthread_cond_broadcast(cond());
77
assert_status(status == 0, status, "cond_broadcast");
78
}
79
80
#endif // OS_POSIX_OS_POSIX_INLINE_HPP
81
82