git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Modules/UDI - Implimenting UDI support, can load udi_dpt from udiref
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
workqueue.c
diff --git
a/KernelLand/Kernel/workqueue.c
b/KernelLand/Kernel/workqueue.c
index
b1a6385
..
2083bde
100644
(file)
--- a/
KernelLand/Kernel/workqueue.c
+++ b/
KernelLand/Kernel/workqueue.c
@@
-9,6
+9,8
@@
#include <workqueue.h>
#include <threads_int.h>
#include <workqueue.h>
#include <threads_int.h>
+#define QUEUENEXT(ptr) (*( (void**)(ptr) + Queue->NextOffset/sizeof(void*) ))
+
// === CODE ===
void Workqueue_Init(tWorkqueue *Queue, const char *Name, size_t NextOfset)
{
// === CODE ===
void Workqueue_Init(tWorkqueue *Queue, const char *Name, size_t NextOfset)
{
@@
-27,27
+29,30
@@
void *Workqueue_GetWork(tWorkqueue *Queue)
if(Queue->Head)
{
void *ret = Queue->Head;
if(Queue->Head)
{
void *ret = Queue->Head;
- Queue->Head =
*( (void**)ret + Queue->NextOffset/sizeof(void*)
);
+ Queue->Head =
QUEUENEXT( ret
);
if(Queue->Tail == ret)
Queue->Tail = NULL;
SHORTREL(&Queue->Protector);
return ret;
}
if(Queue->Tail == ret)
Queue->Tail = NULL;
SHORTREL(&Queue->Protector);
return ret;
}
+ #if 0
+ Threads_int_Sleep(THREAD_STAT_QUEUESLEEP,
+ Queue, 0,
+ &Queue->Sleeper, NULL, &Queue->Protector);
+ #endif
// Go to sleep
SHORTLOCK(&glThreadListLock);
us = Threads_RemActive();
us->WaitPointer = Queue;
us->Status = THREAD_STAT_QUEUESLEEP;
Queue->Sleeper = us;
// Go to sleep
SHORTLOCK(&glThreadListLock);
us = Threads_RemActive();
us->WaitPointer = Queue;
us->Status = THREAD_STAT_QUEUESLEEP;
Queue->Sleeper = us;
+
SHORTREL(&Queue->Protector);
SHORTREL(&glThreadListLock);
// Yield and sleep
SHORTREL(&Queue->Protector);
SHORTREL(&glThreadListLock);
// Yield and sleep
- Threads_Yield();
- if(us->Status == THREAD_STAT_QUEUESLEEP) {
- // Why are we awake?!
- }
+ Threads_int_WaitForStatusEnd(THREAD_STAT_QUEUESLEEP);
us->WaitPointer = NULL;
}
us->WaitPointer = NULL;
}
@@
-58,11
+63,12
@@
void Workqueue_AddWork(tWorkqueue *Queue, void *Ptr)
SHORTLOCK(&Queue->Protector);
if( Queue->Tail )
SHORTLOCK(&Queue->Protector);
if( Queue->Tail )
-
*( (void**)Queue->Tail + Queue->NextOffset/sizeof(void*)
) = Ptr;
+
QUEUENEXT(Queue->Tail
) = Ptr;
else
Queue->Head = Ptr;
Queue->Tail = Ptr;
else
Queue->Head = Ptr;
Queue->Tail = Ptr;
-
+ QUEUENEXT(Ptr) = NULL;
+
if( Queue->Sleeper )
{
if( Queue->Sleeper->Status != THREAD_STAT_ACTIVE )
if( Queue->Sleeper )
{
if( Queue->Sleeper->Status != THREAD_STAT_ACTIVE )
UCC
git Repository :: git.ucc.asn.au