Skip to content

Thread Bootstrap

This file serves as the bootstrap entry point for starting a thread in the @sodacore/core library. It retrieves the thread file to execute from the process arguments and initializes a new ThreadWrapper instance with it.


Features

  • Thread File Resolution: Uses getThreadFileFromArgs to determine which thread file should be executed based on command-line arguments.
  • Thread Initialization: Instantiates a ThreadWrapper with the resolved thread file, starting the thread's execution.

Usage

This file is intended to be executed as a thread entry point, typically by the main process or a thread manager.

typescript
import { getThreadFileFromArgs } from '../helper/utils';
import ThreadWrapper from '../module/thread';

new ThreadWrapper(getThreadFileFromArgs());

API

  • getThreadFileFromArgs(): Parses process arguments to determine the path of the thread file to execute.

  • ThreadWrapper: Class responsible for managing the lifecycle and communication of the thread.


Notes

  • This file should not be imported directly by application code; it is meant to be run as a separate process/thread.
  • Ensures that the correct thread logic is loaded and executed based on runtime arguments.

Released under the Apache-2.0 License.