+ rv = gpCurrentThread->Events & Mask;
+ gpCurrentThread->Events &= ~Mask;
+ gpCurrentThread->WaitMask = -1;
+
+ //Log_Debug("Threads", "- rv = %x", rv);
+
+ return rv;
+}
+
+void Threads_PostEvent(tThread *Thread, Uint32 Events)
+{
+ Thread->Events |= Events;
+ Log_Debug("Threads", "Trigger event %x (->Events = %p) on %p", Events, Thread->Events, Thread);
+
+ if( Events == 0 || Thread->WaitMask & Events ) {
+ Threads_Glue_SemSignal( Thread->EventSem, 1 );
+// Log_Debug("Threads", "Waking %p(%i %s)", Thread, Thread->TID, Thread->ThreadName);