Function
queuedScheduler
(
tasks: Array<() => void>,
onOperation: (fiber: Fiber.Fiber<unknown, unknown>) => void
)
Source from the content-addressed store, hash-verified
| 386 | it.effect("queued withPermits interrupted at any operation does not leak permits", () => |
| 387 | Effect.gen(function*() { |
| 388 | const queuedScheduler = ( |
| 389 | tasks: Array<() => void>, |
| 390 | onOperation: (fiber: Fiber.Fiber<unknown, unknown>) => void |
| 391 | ) => { |
| 392 | const scheduler: Scheduler.Scheduler = { |
| 393 | executionMode: "async", |
| 394 | makeDispatcher: () => ({ |
| 395 | scheduleTask(task) { |
| 396 | tasks.push(task) |
| 397 | }, |
| 398 | flush() {} |
| 399 | }), |
| 400 | shouldYield: (fiber) => { |
| 401 | onOperation(fiber) |
| 402 | return false |
| 403 | } |
| 404 | } |
| 405 | return scheduler |
| 406 | } |
| 407 | |
| 408 | let operations = 0 |
| 409 | const baselineSem = yield* Semaphore.make(1) |
Tested by
no test coverage detected