swift
7761cdfc - Fix bug in Dispatch executor preventing long sleeps

Commit
2 years ago
Fix bug in Dispatch executor preventing long sleeps Dispatch executor's swift_task_enqueueGlobalWithDelayImpl adds the requested delay to the current time and enqueues the job to run at that time. This has a bug when using a very large delay on the order of 2^63 to 2^64 nanoseconds because dispatch_time(), which is used to preform the now + delay calculation, returns DISPATCH_TIME_FOREVER. However, dispatch_after(), which is used to actually enqueue the job, has undefined behavior for this time; the result in practice is that the job is immediately run. This change resolves the bug by leaking the job if the result of dispatch_time is DISPATCH_TIME_FOREVER. This should effectively be the same as the job getting delayed forever. Radar-Id: rdar://problem/89455918
Author
Committer
Parents
  • stdlib/public
    • BackDeployConcurrency
      • File
        DispatchGlobalExecutor.inc
    • Concurrency
      • File
        DispatchGlobalExecutor.inc