BaseWorker
This file defines the BaseWorker
class, which provides a simple utility for accessing the current thread's ID in a Node.js worker thread environment.
Features
- Thread ID Access: Exposes a method to retrieve the current worker thread's ID using Node.js's
worker_threads
module.
Usage
typescript
import BaseWorker from './base/worker';
const worker = new BaseWorker();
console.log('Current thread ID:', worker.getThreadId());
API
Methods
public getThreadId(): number
Returns the current worker thread's ID.
Notes
- This class is intended for use in environments where Node.js worker threads are utilized.
- The
threadId
is provided by theworker_threads
module and uniquely identifies each worker.