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
Usermode/GUI - Hack in attribute reset
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
threads.c
diff --git
a/KernelLand/Kernel/threads.c
b/KernelLand/Kernel/threads.c
index
280f7f2
..
4dcdb94
100644
(file)
--- a/
KernelLand/Kernel/threads.c
+++ b/
KernelLand/Kernel/threads.c
@@
-10,6
+10,7
@@
#include <errno.h>
#include <hal_proc.h>
#include <semaphore.h>
#include <errno.h>
#include <hal_proc.h>
#include <semaphore.h>
+#include <rwlock.h>
#include <vfs_threads.h> // VFS Handle maintainence
#include <events.h>
#include <vfs_threads.h> // VFS Handle maintainence
#include <events.h>
@@
-49,7
+50,7
@@
void Threads_Delete(tThread *Thread);
char *Threads_GetName(tTID ID);
#if 0
void Threads_SetPriority(tThread *Thread, int Pri);
char *Threads_GetName(tTID ID);
#if 0
void Threads_SetPriority(tThread *Thread, int Pri);
-tThread *Threads_CloneTCB(Uint
*Err, Uint
Flags);
+tThread *Threads_CloneTCB(Uint Flags);
int Threads_WaitTID(int TID, int *status);
tThread *Threads_GetThread(Uint TID);
#endif
int Threads_WaitTID(int TID, int *status);
tThread *Threads_GetThread(Uint TID);
#endif
@@
-59,9
+60,7
@@
void Threads_int_AddToList(tThreadList *List, tThread *Thread);
void Threads_Exit(int TID, int Status);
void Threads_Kill(tThread *Thread, int Status);
void Threads_Yield(void);
void Threads_Exit(int TID, int Status);
void Threads_Kill(tThread *Thread, int Status);
void Threads_Yield(void);
-#endif
-void Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock);
-#if 0
+ int Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock);
void Threads_Sleep(void);
int Threads_Wake(tThread *Thread);
void Threads_AddActive(tThread *Thread);
void Threads_Sleep(void);
int Threads_Wake(tThread *Thread);
void Threads_AddActive(tThread *Thread);
@@
-507,6
+506,7
@@
tTID Threads_WaitTID(int TID, int *Status)
// Specific Thread
if(TID > 0)
{
// Specific Thread
if(TID > 0)
{
+ // TODO: Register on thread to be poked when it dies
tTID ret;
// NOTE: Race condition - Other child dies, desired child dies, first death is 'lost'
while( (ret = Threads_WaitTID(-1, Status)) != TID )
tTID ret;
// NOTE: Race condition - Other child dies, desired child dies, first death is 'lost'
while( (ret = Threads_WaitTID(-1, Status)) != TID )
@@
-754,7
+754,7
@@
void Threads_int_WaitForStatusEnd(enum eThreadStatus Status)
}
}
}
}
-
void
Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock)
+
int
Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **ListHead, tThread **ListTail, tShortSpinlock *Lock)
{
SHORTLOCK( &glThreadListLock );
tThread *us = Threads_RemActive();
{
SHORTLOCK( &glThreadListLock );
tThread *us = Threads_RemActive();
@@
-768,12
+768,11
@@
void Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **
if( ListTail ) {
if(*ListTail) {
(*ListTail)->Next = us;
if( ListTail ) {
if(*ListTail) {
(*ListTail)->Next = us;
- *ListTail = us;
}
else {
*ListHead = us;
}
else {
*ListHead = us;
- *ListTail = us;
}
}
+ *ListTail = us;
}
else {
*ListHead = us;
}
else {
*ListHead = us;
@@
-783,8
+782,10
@@
void Threads_int_Sleep(enum eThreadStatus Status, void *Ptr, int Num, tThread **
// return ;
SHORTREL( &glThreadListLock );
if( Lock )
// return ;
SHORTREL( &glThreadListLock );
if( Lock )
- SHORT
LOCK
( Lock );
+ SHORT
REL
( Lock );
Threads_int_WaitForStatusEnd(Status);
Threads_int_WaitForStatusEnd(Status);
+ us->WaitPointer = NULL;
+ return us->RetStatus;
}
/**
}
/**
@@
-1251,6
+1252,11
@@
void Threads_int_DumpThread(tThread *thread)
case THREAD_STAT_MUTEXSLEEP:
Log(" Mutex Pointer: %p", thread->WaitPointer);
break;
case THREAD_STAT_MUTEXSLEEP:
Log(" Mutex Pointer: %p", thread->WaitPointer);
break;
+ case THREAD_STAT_RWLOCKSLEEP:
+ Log(" Lock Pointer: %p", thread->WaitPointer);
+ Log(" Lock Name: %s",
+ ((tRWLock*)thread->WaitPointer)->Name);
+ break;
case THREAD_STAT_SEMAPHORESLEEP:
Log(" Semaphore Pointer: %p", thread->WaitPointer);
Log(" Semaphore Name: %s:%s",
case THREAD_STAT_SEMAPHORESLEEP:
Log(" Semaphore Pointer: %p", thread->WaitPointer);
Log(" Semaphore Name: %s:%s",
@@
-1259,7
+1265,7
@@
void Threads_int_DumpThread(tThread *thread)
);
break;
case THREAD_STAT_EVENTSLEEP:
);
break;
case THREAD_STAT_EVENTSLEEP:
- // TODO: Event mask
+ Log(" Event Mask: %x", thread->RetStatus);
break;
case THREAD_STAT_ZOMBIE:
Log(" Return Status: %i", thread->RetStatus);
break;
case THREAD_STAT_ZOMBIE:
Log(" Return Status: %i", thread->RetStatus);
UCC
git Repository :: git.ucc.asn.au