# Thread<T> constructor

Thread<T>(

1. dynamic _entryPoint(
   1. ThreadMessage
   ), {
2. dynamic initialMessage,
3. String? debugName,

})

Emulates Java's `Thread` class using Dart's `Isolate`.

A Thread represents a separate unit of execution and encapsulates a Dart `Isolate` under the hood. Each Thread has its own memory space and runs independently from others.

This class provides Java-style threading behaviors such as:

- `start()`
- `join()`
- `interrupt()`
- static utilities like `sleep()`, `currentThread()`, and `getThreadLocal(id)`

Example usage:

    void entry(ThreadMessage message) {
      print("Thread started with data: ${message.data}");
      message.replyPort.send('done');
    }

    void main() async {
      final thread = Thread(entry, initialMessage: 'Hello', debugName: 'worker-1');
      await thread.start();
      await thread.join();
      print('Thread completed.');
    }

## Implementation

    Thread(this._entryPoint, {this.initialMessage, String? debugName}) {
      _debugName = debugName ?? 'DartThread-${DateTime.now().microsecondsSinceEpoch}';
    }