UNPKG

simple-task-master

Version:
55 lines 1.63 kB
export declare class LockManager { private readonly lockPath; protected readonly LOCK_TIMEOUT_MS = 30000; protected readonly LOCK_CHECK_INTERVAL_MS = 100; protected readonly MAX_LOCK_RETRIES = 100; private static instances; private static globalCleanupHandlersSetup; private static cleanupListeners; constructor(projectRoot: string); /** * Acquire a lock for exclusive operations. * Uses atomic file creation with O_EXCL flag. * Retries with 100ms intervals up to 50 times (5 seconds total). * Automatically cleans up stale locks. */ acquire(): Promise<void>; /** * Release the lock by removing the lock file. * Only releases if the current process owns the lock. */ release(): Promise<void>; /** * Check if a lock file exists */ private exists; /** * Read and parse the lock file */ private read; /** * Force release a lock without checking ownership */ private forceRelease; /** * Check if a process with the given PID is still alive */ protected isProcessAlive(pid: number): boolean; /** * Sleep for the specified number of milliseconds */ private sleep; /** * Setup global cleanup handlers to release all locks on process exit */ private setupGlobalCleanupHandlers; /** * Remove this instance from cleanup registry (for testing) */ dispose(): void; /** * Clean up all global event listeners (for testing) */ static disposeGlobalListeners(): void; } //# sourceMappingURL=lock-manager.d.ts.map