< prev index next >
src/os/bsd/vm/os_bsd.cpp
Print this page
@@ -1962,17 +1962,13 @@
Semaphore::~Semaphore() {
SEM_DESTROY(_semaphore);
}
-void Semaphore::signal() {
- SEM_POST(_semaphore);
-}
-
void Semaphore::signal(uint count) {
for (uint i = 0; i < count; i++) {
- signal();
+ SEM_POST(_semaphore);
}
}
void Semaphore::wait() {
while (SEM_WAIT(_semaphore) == KERN_ABORTED) {
@@ -2024,28 +2020,27 @@
return kr == KERN_SUCCESS;
}
};
-#else
+typedef BsdSemaphore OSSemaphore;
-class BsdSemaphore : public os::PosixSemaphore {
- public:
- BsdSemaphore(uint value = 0) : os::PosixSemaphore(value) {}
+#else
- bool BsdSemaphore::timedwait(unsigned int sec, int nsec) {
+struct timespec os::PosixSemaphore::create_timespec(unsigned int sec, int nsec) {
struct timespec ts;
unpackTime(&ts, false, (sec * NANOSECS_PER_SEC) + nsec);
- return os::PosixSemaphore::timedwait(ts);
- }
-};
+ return ts;
+}
+
+typedef os::PosixSemaphore OSSemaphore;
#endif // __APPLE__
static os_semaphore_t sig_sem;
-static BsdSemaphore sr_semaphore;
+static OSSemaphore sr_semaphore;
void os::signal_init_pd() {
// Initialize signal structures
::memset((void*)pending_signals, 0, sizeof(pending_signals));
< prev index next >