From: John Hodge Date: Sun, 26 Feb 2012 13:25:07 +0000 (+0800) Subject: Kernel - Added another event and allowed clearing of events X-Git-Tag: rel0.15~750 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=cfe6a9f2a126cc26ac74d5454e8378bd1193fcf8;p=tpg%2Facess2.git Kernel - Added another event and allowed clearing of events - Also allowed Proc_GetCurThread to be accessed outside > It's needed for events --- diff --git a/KernelLand/Kernel/events.c b/KernelLand/Kernel/events.c index a9eab786..da095e9e 100644 --- a/KernelLand/Kernel/events.c +++ b/KernelLand/Kernel/events.c @@ -41,6 +41,14 @@ void Threads_PostEvent(tThread *Thread, Uint32 EventMask) LEAVE('-'); } +/** + * \brief Clear an event without waiting + */ +void Threads_ClearEvent(Uint32 EventMask) +{ + Proc_GetCurThread()->EventState &= ~EventMask; +} + /** * \brief Wait for an event to occur */ diff --git a/KernelLand/Kernel/include/events.h b/KernelLand/Kernel/include/events.h index 675c3dbc..57709405 100644 --- a/KernelLand/Kernel/include/events.h +++ b/KernelLand/Kernel/include/events.h @@ -14,9 +14,11 @@ #define THREAD_EVENT_IPCMSG 0x00000002 #define THREAD_EVENT_SIGNAL 0x00000004 #define THREAD_EVENT_TIMER 0x00000008 +#define THREAD_EVENT_SHORTWAIT 0x00000010 // === FUNCTIONS === extern void Threads_PostEvent(tThread *Thread, Uint32 EventMask); +extern void Threads_ClearEvent(Uint32 EventMask); extern Uint32 Threads_WaitEvents(Uint32 EventMask); #endif diff --git a/KernelLand/Kernel/include/threads.h b/KernelLand/Kernel/include/threads.h index 9ff7b629..0362cdb4 100644 --- a/KernelLand/Kernel/include/threads.h +++ b/KernelLand/Kernel/include/threads.h @@ -23,6 +23,8 @@ enum eFaultNumbers typedef struct sThread tThread; // === FUNCTIONS === +extern tThread *Proc_GetCurThread(void); + extern void Threads_SetFaultHandler(Uint Handler); extern int Threads_SetUID(tUID ID); diff --git a/KernelLand/Kernel/include/threads_int.h b/KernelLand/Kernel/include/threads_int.h index 66bb8c16..515ab0a3 100644 --- a/KernelLand/Kernel/include/threads_int.h +++ b/KernelLand/Kernel/include/threads_int.h @@ -125,8 +125,6 @@ extern BOOL gaThreads_NoTaskSwitch[MAX_CPUS]; extern tShortSpinlock glThreadListLock; // === FUNCTIONS === -extern tThread *Proc_GetCurThread(void); - extern tThread *Threads_GetThread(Uint TID); extern void Threads_SetPriority(tThread *Thread, int Pri); extern int Threads_Wake(tThread *Thread); diff --git a/KernelLand/Kernel/vfs/select.c b/KernelLand/Kernel/vfs/select.c index 439afc02..d2ef8082 100644 --- a/KernelLand/Kernel/vfs/select.c +++ b/KernelLand/Kernel/vfs/select.c @@ -20,9 +20,6 @@ // === CONSTANTS === #define NUM_THREADS_PER_ALLOC 4 -// === IMPORTS === -extern tThread *Proc_GetCurThread(void); - // === TYPES === typedef struct sVFS_SelectListEnt tVFS_SelectListEnt;