* \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;
// 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 );
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