rthread is a simple multi-threaded C program that launches a given runtime (like npm
or uvicorn
) for a target application file using POSIX threads and process forking.
Screen.Recording.2025-06-03.at.11.07.52.PM.mov
- Launches a subprocess using a thread per process.
- Accepts CLI arguments to configure runtime, file path, and port.
- Automatically converts Python file paths to ASGI module format for
uvicorn
.
We don't version to Download to Windows (.exe
):
- gitchange.exe
$ apt install rthread
$ brew install rthread
make
gcc main.c src/for_uvicorn.c src/process_list.c src/logs.c -o rthread \
-Iinclude \
-I/opt/homebrew/Cellar/cjson/1.7.18/include \
-L/opt/homebrew/Cellar/cjson/1.7.18/lib \
-lcjson -lpthread
$ rthread -m [NPM|UVICORN] -r [ROOT(main.py)] -p [PORT]
# Python
$ rthread -m uvicorn -r samples/fastapi/app.py -p 8080
# Node
$ rthread -m node -r samples/express/app.js -p 8080
main.c
: Main source fileThreadStruct
: Contains data for each threadrun_process
: Forks and executes the process in a threadformat_module_path
: Convertspath/to/file.py
topath.to.file:app
- Currently supports only one thread/process by default (
num_threads = 1
). - Assumes the target file is valid and accessible.
- If using
uvicorn
, make sure the path points to a valid ASGI app.