Remove the now unused sw::Event.
Bug: b/140546382
Change-Id: I71253f73dcd3c2083873cb1f0084b42190e9df8e
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38209
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/System/Synchronization.hpp b/src/System/Synchronization.hpp
index 3d2fc49..5af65e2 100644
--- a/src/System/Synchronization.hpp
+++ b/src/System/Synchronization.hpp
@@ -117,101 +117,6 @@
std::condition_variable condition;
};
-// Event is a synchronization mechanism used to indicate to waiting threads
-// when a boolean condition has become true.
-class Event
-{
-public:
- enum class ClearMode
- {
- // The event signal will be automatically reset when a call to wait()
- // returns.
- // A single call to signal() will only unblock a single (possibly
- // pending) call to wait().
- Auto,
-
- // The event will remain in the signaled state when calling signal().
- // While the event is in the signaled state, any calls to wait() will
- // unblock without automatically reseting the signaled state.
- // The signaled state can be reset with a call to clear().
- Manual
- };
-
-
- Event(ClearMode mode = ClearMode::Auto, bool initialState = false)
- : mode(mode), signaled(initialState) {}
-
- // signal() signals the event, unblocking any calls to wait().
- void signal()
- {
- std::unique_lock<std::mutex> lock(mutex);
- signaled = true;
- if (mode == ClearMode::Auto)
- {
- condition.notify_one();
- }
- else
- {
- condition.notify_all();
- }
- }
-
- // clear() sets the event signal to false.
- void clear()
- {
- std::unique_lock<std::mutex> lock(mutex);
- signaled = false;
- }
-
- // wait() blocks until all the event signal is set to true.
- // If the event was constructed with the Auto ClearMode, then the signal
- // is cleared before returning.
- void wait()
- {
- std::unique_lock<std::mutex> lock(mutex);
- condition.wait(lock, [this] { return signaled; });
- if (mode == ClearMode::Auto)
- {
- signaled = false;
- }
- }
-
- // wait() blocks until the event signal is set to true or the timeout
- // has been reached, returning true if signal was raised, or false if the
- // timeout has been reached.
- // If the event was constructed with the Auto ClearMode and the wait did
- // not time out, then the signal is cleared before returning.
- template <class CLOCK, class DURATION>
- bool wait(const std::chrono::time_point<CLOCK, DURATION>& timeout)
- {
- std::unique_lock<std::mutex> lock(mutex);
- if (!condition.wait_until(lock, timeout, [this] { return signaled; }))
- {
- return false;
- }
- if (mode == ClearMode::Auto)
- {
- signaled = false;
- }
- return true;
- }
-
- // bool() returns true if the event is signaled, otherwise false.
- // Note: No lock is held after bool() returns, so the event state may
- // immediately change after returning.
- operator bool()
- {
- std::unique_lock<std::mutex> lock(mutex);
- return signaled;
- }
-
-public:
- const ClearMode mode;
- bool signaled; // guarded by mutex
- std::mutex mutex;
- std::condition_variable condition;
-};
-
// Chan is a thread-safe FIFO queue of type T.
// Chan takes its name after Golang's chan.
template <typename T>