summaryrefslogtreecommitdiff
path: root/Source/WTF/wtf/threads
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WTF/wtf/threads
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WTF/wtf/threads')
-rw-r--r--Source/WTF/wtf/threads/BinarySemaphore.cpp11
-rw-r--r--Source/WTF/wtf/threads/BinarySemaphore.h13
2 files changed, 7 insertions, 17 deletions
diff --git a/Source/WTF/wtf/threads/BinarySemaphore.cpp b/Source/WTF/wtf/threads/BinarySemaphore.cpp
index 5f60aaf22..f4452496a 100644
--- a/Source/WTF/wtf/threads/BinarySemaphore.cpp
+++ b/Source/WTF/wtf/threads/BinarySemaphore.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,8 +26,6 @@
#include "config.h"
#include "BinarySemaphore.h"
-#if !PLATFORM(WIN)
-
namespace WTF {
BinarySemaphore::BinarySemaphore()
@@ -47,13 +45,14 @@ void BinarySemaphore::signal()
m_condition.signal();
}
-bool BinarySemaphore::wait(double absoluteTime)
+bool BinarySemaphore::wait(TimeWithDynamicClockType absoluteTime)
{
MutexLocker locker(m_mutex);
bool timedOut = false;
while (!m_isSet) {
- timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
+ timedOut = !m_condition.timedWait(
+ m_mutex, absoluteTime.approximateWallTime().secondsSinceEpoch().value());
if (timedOut)
return false;
}
@@ -64,5 +63,3 @@ bool BinarySemaphore::wait(double absoluteTime)
}
} // namespace WTF
-
-#endif // !PLATFORM(WIN)
diff --git a/Source/WTF/wtf/threads/BinarySemaphore.h b/Source/WTF/wtf/threads/BinarySemaphore.h
index cae10231b..bb00d776f 100644
--- a/Source/WTF/wtf/threads/BinarySemaphore.h
+++ b/Source/WTF/wtf/threads/BinarySemaphore.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
#include <wtf/Noncopyable.h>
#include <wtf/ThreadingPrimitives.h>
+#include <wtf/TimeWithDynamicClockType.h>
namespace WTF {
@@ -39,21 +40,13 @@ public:
WTF_EXPORT_PRIVATE ~BinarySemaphore();
WTF_EXPORT_PRIVATE void signal();
- WTF_EXPORT_PRIVATE bool wait(double absoluteTime);
-
-#if PLATFORM(WIN)
- HANDLE event() const { return m_event; }
-#endif
+ WTF_EXPORT_PRIVATE bool wait(TimeWithDynamicClockType);
private:
-#if PLATFORM(WIN)
- HANDLE m_event;
-#else
bool m_isSet;
Mutex m_mutex;
ThreadCondition m_condition;
-#endif
};
} // namespace WTF