#include <rwlock.h>
#include <vfs_threads.h> // VFS Handle maintainence
#include <events.h>
+#include <debug_hooks.h>
// Configuration
#define DEBUG_TRACE_ACTIVEQUEUE 0 // Trace adds/removals from the active queue
int Threads_Wake(tThread *Thread);
void Threads_AddActive(tThread *Thread);
tThread *Threads_RemActive(void);
-#endif
void Threads_ToggleTrace(int TID);
+#endif
void Threads_Fault(int Num);
void Threads_SegFault(tVAddr Addr);
void Threads_PostSignalTo(tThread *Thread, int SignalNum);
int Threads_SetGID(Uint *Errno, tUID ID);
#endif
void Threads_int_DumpThread(tThread *thread);
+#if 0
void Threads_Dump(void);
+#endif
void Threads_DumpActive(void);
tThread *Threads_int_GetRunnable(void);
if(Flags & CLONE_VM) {
tProcess *newproc, *oldproc;
oldproc = cur->Process;
- new->Process = malloc( sizeof(struct sProcess) );
+ new->Process = calloc( sizeof(struct sProcess), 1 );
newproc = new->Process;
newproc->PID = new->TID;
if( Flags & CLONE_PGID )
}
*ListTail = us;
}
- else {
+ else if( ListHead ) {
+ us->Next = *ListHead;
*ListHead = us;
}
+ else {
+ // Nothing
+ }
//if( Proc_ThreadSync(us) )
// return ;
*/
void Threads_DumpActive(void)
{
- tThread *thread;
- tThreadList *list;
- #if SCHEDULER_TYPE == SCHED_RR_PRI
- int i;
- #endif
-
Log("Active Threads: (%i reported)", giNumActiveThreads);
#if SCHEDULER_TYPE == SCHED_RR_PRI
- for( i = 0; i < MIN_PRIORITY+1; i++ )
+ for( int i = 0; i < MIN_PRIORITY+1; i++ )
{
- list = &gaActiveThreads[i];
+ tThreadList *list = &gaActiveThreads[i];
#else
- list = &gActiveThreads;
+ tThreadList *list = &gActiveThreads;
#endif
- for(thread=list->Head;thread;thread=thread->Next)
+ for(tThread *thread = list->Head; thread; thread = thread->Next)
{
Threads_int_DumpThread(thread);
if(thread->Status != THREAD_STAT_ACTIVE)