TaskInfo* taskTable;
static nat taskTableSize;
-HashTable *taskHash; // maps OSThreadID to TaskInfo*
+// maps OSThreadID to TaskInfo*
+HashTable *taskHash;
nat taskCount;
static nat tasksRunning;
static int initialized = 0;
if (!initialized) {
+#if defined(SMP)
+ taskTableSize = stg_max(INIT_TASK_TABLE_SIZE,
+ RtsFlags.ParFlags.nNodes * 2);
+#else
taskTableSize = INIT_TASK_TABLE_SIZE;
+#endif
taskTable = stgMallocBytes( taskTableSize * sizeof(TaskInfo),
"initTaskManager");
static void
expandTaskTable (void)
{
+ nat i;
+
taskTableSize *= 2;
taskTable = stgReallocBytes(taskTable, taskTableSize * sizeof(TaskInfo),
"expandTaskTable");
+
+ /* Have to update the hash table now... */
+ for (i = 0; i < taskCount; i++) {
+ removeHashTable( taskHash, taskTable[i].id, NULL );
+ insertHashTable( taskHash, taskTable[i].id, &taskTable[i] );
+ }
}
void
IF_DEBUG(scheduler, sched_belch("all tasks stopped"));
return;
}
+ IF_DEBUG(scheduler, sched_belch("yielding"));
prodWorker();
yieldThread();
}
}
ASSERT(task_info->id == id);
- task_info->stopped = rtsTrue;
- tasksRunning--;
-
stat_getTimes(¤tElapsedTime, ¤tUserTime, &elapsedGCTime);
task_info->mut_time =
if (task_info->mut_time < 0.0) { task_info->mut_time = 0.0; }
if (task_info->mut_etime < 0.0) { task_info->mut_etime = 0.0; }
+
+ task_info->stopped = rtsTrue;
+ tasksRunning--;
}
void