Interface WasiThreadModule


  • public interface WasiThreadModule
    Marker interface for WasmModule implementations that support WASI threading.

    A WasiThreadModule provides an entry point for threads spawned through the WASI threading API. When a new thread is created, the wasi_thread_start(int, int) method is invoked by the runtime with the appropriate thread and argument identifiers.

    This interface should be implemented by modules that are intended to participate in multi-threaded execution using WASI. Modules that do not implement this interface are considered single-threaded and will not receive thread start callbacks.

    Implementation requirement: implementations must declare the wasi_thread_start method as native and synchronized, with the following signature:

    
     public native synchronized void wasi_thread_start(int threadId, int args);
     

    This requirement ensures that the method is bound to the wasi_thread_start function exported by the underlying WASM module and can be safely invoked in a concurrent environment.

    • Method Detail

      • wasi_thread_start

        void wasi_thread_start​(int threadId,
                               int args)
        Entry point invoked when a new WASI thread is started.
        Parameters:
        threadId - an identifier for the newly created thread
        args - an argument passed to the thread at creation time