See #805. This was here to catch bugs that resulted in an infinite
number of worker threads being created. However, we can't put a
reasonable bound on the number of worker threads, because legitimate
programs may need to create large numbers of (probably blocked) worker
threads. Furthermore, the OS probably has a bound on the number of
threads that a process can create in any case.
Task *all_tasks = NULL;
static Task *task_free_list = NULL; // singly-linked
static nat taskCount;
Task *all_tasks = NULL;
static Task *task_free_list = NULL; // singly-linked
static nat taskCount;
-#define DEFAULT_MAX_WORKERS 64
-static nat maxWorkers; // we won't create more workers than this
static nat tasksRunning;
static nat workerCount;
static nat tasksRunning;
static nat workerCount;
taskCount = 0;
workerCount = 0;
tasksRunning = 0;
taskCount = 0;
workerCount = 0;
tasksRunning = 0;
-#if defined(THREADED_RTS)
- maxWorkers = DEFAULT_MAX_WORKERS * RtsFlags.ParFlags.nNodes;
-#else
- maxWorkers = DEFAULT_MAX_WORKERS;
-#endif
initialized = 1;
#if defined(THREADED_RTS)
newThreadLocalKey(¤tTaskKey);
initialized = 1;
#if defined(THREADED_RTS)
newThreadLocalKey(¤tTaskKey);
OSThreadId tid;
Task *task;
OSThreadId tid;
Task *task;
- if (workerCount >= maxWorkers) {
- barf("too many workers; runaway worker creation?");
- }
workerCount++;
// A worker always gets a fresh Task structure.
workerCount++;
// A worker always gets a fresh Task structure.