--- a/src/hotspot/os/posix/os_posix.cpp Thu Jan 11 11:28:51 2018 +0100
+++ b/src/hotspot/os/posix/os_posix.cpp Thu Jan 11 18:42:36 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,14 +31,8 @@
#include "utilities/macros.hpp"
#include "utilities/vmError.hpp"
-#ifndef __APPLE__
-// POSIX unamed semaphores are not supported on OS X.
-#include "semaphore_posix.hpp"
-#endif
-
#include <dlfcn.h>
#include <pthread.h>
-#include <semaphore.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/resource.h>
@@ -1499,67 +1493,6 @@
}
}
-// POSIX unamed semaphores are not supported on OS X.
-#ifndef __APPLE__
-
-PosixSemaphore::PosixSemaphore(uint value) {
- int ret = sem_init(&_semaphore, 0, value);
-
- guarantee_with_errno(ret == 0, "Failed to initialize semaphore");
-}
-
-PosixSemaphore::~PosixSemaphore() {
- sem_destroy(&_semaphore);
-}
-
-void PosixSemaphore::signal(uint count) {
- for (uint i = 0; i < count; i++) {
- int ret = sem_post(&_semaphore);
-
- assert_with_errno(ret == 0, "sem_post failed");
- }
-}
-
-void PosixSemaphore::wait() {
- int ret;
-
- do {
- ret = sem_wait(&_semaphore);
- } while (ret != 0 && errno == EINTR);
-
- assert_with_errno(ret == 0, "sem_wait failed");
-}
-
-bool PosixSemaphore::trywait() {
- int ret;
-
- do {
- ret = sem_trywait(&_semaphore);
- } while (ret != 0 && errno == EINTR);
-
- assert_with_errno(ret == 0 || errno == EAGAIN, "trywait failed");
-
- return ret == 0;
-}
-
-bool PosixSemaphore::timedwait(struct timespec ts) {
- while (true) {
- int result = sem_timedwait(&_semaphore, &ts);
- if (result == 0) {
- return true;
- } else if (errno == EINTR) {
- continue;
- } else if (errno == ETIMEDOUT) {
- return false;
- } else {
- assert_with_errno(false, "timedwait failed");
- return false;
- }
- }
-}
-
-#endif // __APPLE__
-
// Shared pthread_mutex/cond based PlatformEvent implementation.
// Not currently usable by Solaris.