| 350 | }) |
| 351 | } |
| 352 | private offerRemainingArray(remaining: Array<A>) { |
| 353 | return core.asyncInterrupt<Chunk.Chunk<A>>((resume) => { |
| 354 | if (this.state._tag !== "Open") { |
| 355 | return resume(core.exitSucceed(Chunk.unsafeFromArray(remaining))) |
| 356 | } |
| 357 | const entry: OfferEntry<A> = { _tag: "Array", remaining, offset: 0, resume } |
| 358 | this.state.offers.add(entry) |
| 359 | return core.sync(() => { |
| 360 | if (this.state._tag === "Open") { |
| 361 | this.state.offers.delete(entry) |
| 362 | } |
| 363 | }) |
| 364 | }) |
| 365 | } |
| 366 | private releaseCapacity(): boolean { |
| 367 | if (this.state._tag === "Done") { |
| 368 | return this.state.exit._tag === "Success" |