Skip to content
Snippets Groups Projects
Commit 745b0dcc authored by John Hodge's avatar John Hodge
Browse files

More thread issue fixing, still not working

parent 126cef9a
Branches
No related merge requests found
......@@ -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;
......
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment