#include <errno.h>
#endif
+#ifdef TRACING
+#include "eventlog/EventLog.h"
+#endif
/* -----------------------------------------------------------------------------
* Global variables
* -------------------------------------------------------------------------- */
blocks = (lnat)BLOCK_ROUND_UP(cap->r.rHpAlloc) / BLOCK_SIZE;
+ if (blocks > BLOCKS_PER_MBLOCK) {
+ barf("allocation of %ld bytes too large (GHC should have complained at compile-time)", (long)cap->r.rHpAlloc);
+ }
+
debugTrace(DEBUG_sched,
"--<< thread %ld (%s) stopped: requesting a large block (size %ld)\n",
(long)t->id, what_next_strs[t->what_next], blocks);
cap->r.rNursery->n_blocks == 1) { // paranoia to prevent infinite loop
// if the nursery has only one block.
- ACQUIRE_SM_LOCK
- bd = allocGroup( blocks );
- RELEASE_SM_LOCK
- cap->r.rNursery->n_blocks += blocks;
+ bd = allocGroup_lock(blocks);
+ cap->r.rNursery->n_blocks += blocks;
// link the new group into the list
bd->link = cap->r.rCurrentNursery;
stopTimer(); // See #4074
+#if defined(TRACING)
+ flushEventLog(); // so that child won't inherit dirty file buffers
+#endif
+
pid = fork();
if (pid) { // parent
initMutex(&cap->running_task->lock);
#endif
+#if defined(TRACING)
+ abortEventLogging(); // abort eventlog inherited from parent
+ initEventLogging(); // child starts its own eventlog
+#endif
// Now, all OS threads except the thread that forked are
// stopped. We need to stop all Haskell threads, including
// those involved in foreign calls. Also we need to delete
// Wipe our spare workers list, they no longer exist. New
// workers will be created if necessary.
cap->spare_workers = NULL;
- cap->returning_tasks_hd = NULL;
+ cap->n_spare_workers = 0;
+ cap->returning_tasks_hd = NULL;
cap->returning_tasks_tl = NULL;
#endif