Duncan Coutts pushed to branch wip/io-manager-deadlock-detection at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • rts/posix/Select.c
    ... ... @@ -277,8 +277,16 @@ awaitCompletedTimeoutsOrIOSelect(CapIOManager *iomgr, bool wait)
    277 277
         do {
    
    278 278
     
    
    279 279
           now = getLowResTimeOfDay();
    
    280
    -      if (wakeUpSleepingThreads(iomgr, now)) {
    
    281
    -          return true;
    
    280
    +      wakeUpSleepingThreads(iomgr, now);
    
    281
    +#if defined(RTS_USER_SIGNALS)
    
    282
    +      startPendingSignalHandlers(iomgr->cap);
    
    283
    +#endif
    
    284
    +      /* If either of the above (checking for timers or signal) caused threads
    
    285
    +       * to be started (or if the run queue was non-empty in the first place),
    
    286
    +       * then poll for I/O but don't block waiting.
    
    287
    +       */
    
    288
    +      if (!emptyRunQueue(iomgr->cap)) {
    
    289
    +          wait = false;
    
    282 290
           }
    
    283 291
     
    
    284 292
           /*
    

  • rts/posix/Signals.c
    ... ... @@ -340,6 +340,9 @@ startPendingSignalHandlers(Capability *cap)
    340 340
                // freed by runHandler
    
    341 341
         memcpy(info, next_pending_handler, sizeof(siginfo_t));
    
    342 342
     
    
    343
    +    debugTrace(DEBUG_iomanager,
    
    344
    +               "Handling pending signal, no %d", info->si_signo);
    
    345
    +
    
    343 346
         StgTSO *t =
    
    344 347
             createIOThread(cap,
    
    345 348
                            RtsFlags.GcFlags.initialStkSize,