From: John Hodge Date: Tue, 7 Sep 2010 01:14:35 +0000 (+0800) Subject: More thread issue fixing, still not working X-Git-Tag: rel0.06~28 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=745b0dcc28d1d7765fe4d3beb0090acd75dfec50;p=tpg%2Facess2.git More thread issue fixing, still not working --- diff --git a/Kernel/arch/x86/include/arch.h b/Kernel/arch/x86/include/arch.h index 0126be31..3ce91308 100644 --- a/Kernel/arch/x86/include/arch.h +++ b/Kernel/arch/x86/include/arch.h @@ -74,6 +74,7 @@ static inline int CPU_HAS_LOCK(struct sShortSpinlock *Lock) { * \note This type of lock halts interrupts, so ensure that no timing * functions are called while it is held. As a matter of fact, spend as * little time as possible with this lock held + * \note If \a STACKED_LOCKS is set, this type of spinlock can be nested */ static inline void SHORTLOCK(struct sShortSpinlock *Lock) { int v = 1; diff --git a/Kernel/threads.c b/Kernel/threads.c index aa550ab7..5695955c 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -437,6 +437,14 @@ void Threads_Kill(tThread *Thread, int Status) // Lock thread (stop us recieving messages) SHORTLOCK( &Thread->IsLocked ); + // Clear Message Queue + while( Thread->Messages ) + { + msg = Thread->Messages->Next; + free( Thread->Messages ); + Thread->Messages = msg; + } + // Lock thread list SHORTLOCK( &glThreadListLock ); @@ -449,14 +457,6 @@ void Threads_Kill(tThread *Thread, int Status) return; } - // Clear Message Queue - while( Thread->Messages ) - { - msg = Thread->Messages->Next; - free( Thread->Messages ); // BIG NO-NO - Thread->Messages = msg; - } - // Ensure that we are not rescheduled Thread->Remaining = 0; // Clear Remaining Quantum Thread->Quantum = 0; // Clear Quantum to indicate dead thread