Description: Adapt to upstream modification of jmutex.h
 Upstream added a class "Event" to their jmutex.h, but we build with a
 system-wide jmutex. So put this class into event.h instead
Author: Matthew Bekkema <mat8913ftw@gmail.com>
Date:   Sun Mar 24 19:15:54 2013 +1100
    

--- a/src/emerge.h
+++ b/src/emerge.h
@@ -4,6 +4,7 @@
 #include <map>
 #include <queue>
 #include "util/thread.h"
+#include "event.h"
 
 #define BLOCK_EMERGE_ALLOWGEN (1<<0)
 
--- a/src/event.h
+++ b/src/event.h
@@ -19,6 +19,7 @@
 
 #ifndef EVENT_HEADER
 #define EVENT_HEADER
+#include <semaphore.h>
 
 class MtEvent
 {
@@ -68,5 +69,26 @@
 	virtual void dereg(MtEventReceiver *r, const char *type) = 0;
 };
 
+class Event {
+	sem_t sem;
+
+public:
+	Event() {
+		sem_init(&sem, 0, 0);
+	}
+
+	~Event() {
+		sem_destroy(&sem);
+	}
+
+	void wait() {
+		sem_wait(&sem);
+	}
+
+	void signal() {
+		sem_post(&sem);
+	}
+};
+
 #endif
