| 6207 | resumeAll(shared.callers, callerExit(exit)) |
| 6208 | } |
| 6209 | const startShared = ( |
| 6210 | entry: Entry, |
| 6211 | build: Build, |
| 6212 | callers: Iterable<Waiter>, |
| 6213 | restart: boolean |
| 6214 | ): Shared => { |
| 6215 | const shared: Shared = { |
| 6216 | entry, |
| 6217 | build, |
| 6218 | callers: new Set(), |
| 6219 | fiber: undefined |
| 6220 | } |
| 6221 | for (const caller of callers) { |
| 6222 | caller.shared = shared |
| 6223 | shared.callers.add(caller) |
| 6224 | } |
| 6225 | entry.shared = shared |
| 6226 | sharedFetches.add(shared) |
| 6227 | runShared(shared, restart) |
| 6228 | return shared |
| 6229 | } |
| 6230 | /** A caller leaves: the fetch lives while it has callers. */ |
| 6231 | const leave = (entry: Entry, waiter: Waiter): void => { |
| 6232 | const shared = waiter.shared |