AcessNative - Implemented events, don't trust them
authorJohn Hodge <[email protected]>
Wed, 8 Feb 2012 06:21:40 +0000 (14:21 +0800)
committerJohn Hodge <[email protected]>
Wed, 8 Feb 2012 06:21:40 +0000 (14:21 +0800)
AcessNative/acesskernel_src/Makefile
AcessNative/acesskernel_src/threads.c

index a9b7278..ef63ff2 100644 (file)
@@ -11,7 +11,7 @@ ifeq ($(PLATFORM),)
        PLATFORM := lin\r
 endif\r
 \r
-KERNEL_SRC = ../../Kernel/\r
+KERNEL_SRC = ../../KernelLand/Kernel/\r
 \r
 KERNEL_OBJ := logging.o adt.o lib.o drvutil.o debug.o\r
 KERNEL_OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/io.o vfs/dir.o\r
index 1e7d0c3..a39fb5e 100644 (file)
@@ -70,6 +70,9 @@ typedef struct sThread
 
        tProcess        *Process;       
 
+       Uint32  Events, WaitMask;
+       SDL_sem *EventSem;
+
 }      tThread;
 
 // === PROTOTYPES ===
@@ -359,3 +362,23 @@ int Semaphore_Signal(tSemaphore *Sem, int AmmountToAdd)
        return AmmountToAdd;
 }
 
+Uint32 Threads_WaitEvents(Uint32 Mask)
+{
+       Uint32  rv;
+       gpCurrentThread->WaitMask = Mask;
+       if( !(gpCurrentThread->Events & Mask) )
+               SDL_SemWait( gpCurrentThread->EventSem );
+       rv = gpCurrentThread->Events & Mask;
+       gpCurrentThread->Events &= ~Mask;
+       gpCurrentThread->WaitMask = -1;
+       return rv;
+}
+
+void Threads_PostEvent(tThread *Thread, Uint32 Events)
+{
+       Thread->Events |= Events;
+       
+       if( Thread->WaitMask & Events )
+               SDL_SemPost( gpCurrentThread->EventSem );
+}
+

UCC git Repository :: git.ucc.asn.au