import { Abortable } from '../abortable/Abortable';
import { FrameworkError } from '../error/FrameworkError';
import type { EventBus } from '../event-bus/EventBus';
import type { AnyExecutionContext } from '../execution-context/ExecutionContext';
import type { NamedTask, Task, TaskParam, TaskReturn } from '../task/Types';
import { Deferred } from '../utils/Deferred';
import type { ThreadEvent } from './ThreadEventBus';
import { ThreadEventBus, ThreadEventType } from './ThreadEventBus';
export declare class ThreadTerminationError extends FrameworkError {
    readonly name = "ThreadTerminationError";
    readonly threadStack: string[];
    constructor(rootCause?: Error);
}
export declare class ThreadDisposedError extends FrameworkError {
    readonly name = "ThreadDisposedError";
    constructor(message?: string);
}
export declare enum ThreadState {
    Idle = "idle",
    Disposing = "disposing",
    Disposed = "disposed"
}
export declare class Thread extends ThreadEventBus {
    readonly id: string;
    private readonly children;
    readonly abortController: AbortController;
    protected abortable?: Abortable<unknown>;
    private threadState;
    private readonly executionDeferred;
    private readonly removeAbortListener;
    constructor(eventBus: EventBus<ThreadEventType, ThreadEvent>);
    get onExit(): Deferred<void>;
    get state(): ThreadState;
    createChild(name: string, handleError?: (error: Error) => boolean): Thread;
    private getChildAbortables;
    private waitForChildren;
    abort(reason?: Error): void;
    fork<CTX extends AnyExecutionContext, ForkedTask extends NamedTask<Task<CTX, any, any>>>(context: CTX, task: ForkedTask, parameter: TaskParam<ForkedTask>): Abortable<TaskReturn<ForkedTask>>;
    private handleError;
    private abortAndWaitForChildren;
    private removeChild;
    private dispose;
}
