jumPhp/games/hello-threads/README.md
David Nurdin fc4d0e16ec Threads: TrueAsync runtime (PHP 8.6 ZTS) and Web Workers in the browser
- docker/desktop-async: PHP 8.6 ZTS TrueAsync fork + ext/async + libuv + the SDL
  extensions (php86-compat.h, rect.c shutdown fix); game.yaml runtime: async
- JumPHP\Async: Tasks, Pool, Task, TaskFailed with three backends: TrueAsync
  threads, browser Web Workers (one PHP wasm engine each, closures through
  laravel/serializable-closure), or work spread over the frames
- games/hello-threads: fractal computed by a thread pool at 60 FPS
- browser STDERR fix (Platform::log), core dumps excluded from builds
- docs: AGENTS.md threads section, docs/async.md, README (FR/EN)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 08:26:12 +01:00

1,013 B

HELLO THREADS

Le « hello world » des threads dans JumPHP : une fractale calculée ligne par ligne par un pool de threads PHP (TrueAsync), pendant que la boucle du jeu continue de dessiner à 60 images par seconde. M calcule la même image sur le thread principal pour comparer.

The "hello world" of threads in JumPHP: a fractal computed row by row by a pool of PHP threads (TrueAsync) while the game loop keeps drawing at 60 FPS. M computes the same picture on the main thread to compare.

bin/jumphp install hello-threads
bin/jumphp run hello-threads        # PHP 8.6 ZTS + TrueAsync (image built the first time, ~15 min)

Contrôles / controls: Espace / Space = zone suivante / next spot, M = threads ↔ thread principal / main thread, Échap / Escape = pause.

Dans le navigateur, le même code passe par un pool de Web Workers (un moteur PHP WebAssembly chacun). In the browser the same code uses a pool of Web Workers (one PHP WebAssembly engine each).