MCPcopy Index your code
hub / github.com/andywer/threads.js / createTerminator

Function createTerminator

src/master/spawn.ts:109–118  ·  view source on GitHub ↗
(worker: WorkerType)

Source from the content-addressed store, hash-verified

107}
108
109function createTerminator(worker: WorkerType): { termination: Promise<void>, terminate: () => Promise<void> } {
110 const [termination, resolver] = createPromiseWithResolver<void>()
111 const terminate = async () => {
112 debugThreadUtils("Terminating worker")
113 // Newer versions of worker_threads workers return a promise
114 await worker.terminate()
115 resolver()
116 }
117 return { terminate, termination }
118}
119
120function setPrivateThreadProps<T>(raw: T, worker: WorkerType, workerEvents: Observable<WorkerEvent>, terminate: () => Promise<void>): T & PrivateThreadProps {
121 const workerErrors = workerEvents

Callers 1

spawnFunction · 0.85

Calls 1

Tested by

no test coverage detected