source: trip-planner-front/node_modules/piscina/dist/src/common.d.ts@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/// <reference types="node" />
2import type { MessagePort } from 'worker_threads';
3export interface StartupMessage {
4 filename: string | null;
5 name: string;
6 port: MessagePort;
7 sharedBuffer: Int32Array;
8 useAtomics: boolean;
9 niceIncrement: number;
10}
11export interface RequestMessage {
12 taskId: number;
13 task: any;
14 filename: string;
15 name: string;
16}
17export interface ReadyMessage {
18 ready: true;
19}
20export interface ResponseMessage {
21 taskId: number;
22 result: any;
23 error: Error | null;
24}
25export declare const commonState: {
26 isWorkerThread: boolean;
27 workerData: undefined;
28};
29export declare const kTransferable: unique symbol;
30export declare const kValue: unique symbol;
31export declare const kQueueOptions: unique symbol;
32export declare function isTransferable(value: any): boolean;
33export declare function isMovable(value: any): boolean;
34export declare function markMovable(value: object): void;
35export interface Transferable {
36 readonly [kTransferable]: object;
37 readonly [kValue]: object;
38}
39export interface Task {
40 readonly [kQueueOptions]: object | null;
41}
42export interface TaskQueue {
43 readonly size: number;
44 shift(): Task | null;
45 remove(task: Task): void;
46 push(task: Task): void;
47}
48export declare function isTaskQueue(value: any): boolean;
49export declare const kRequestCountField = 0;
50export declare const kResponseCountField = 1;
51export declare const kFieldCount = 2;
Note: See TracBrowser for help on using the repository browser.