Fix pthread deadlock by using dynamic PTHREAD_POOL_SIZE
The KiCad WASM build was freezing during initialization due to a pthread deadlock. When hardware_concurrency() > PTHREAD_POOL_SIZE, new Web Worker creation requires the event loop, but the main thread busy-waits blocking it. Changes: - Use navigator.hardwareConcurrency for PTHREAD_POOL_SIZE in KiCad build - Add threadpool test to reproduce and verify the fix - Add single-target build support to build-wasm-test.sh - Default docker/build.sh to -j 10 for faster builds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
838d8cb846
commit
ad5c4f6772
6 changed files with 320 additions and 23 deletions
|
|
@ -11,12 +11,18 @@ set -e
|
|||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Add -j 10 by default if no -j flag is given
|
||||
ARGS=("$@")
|
||||
if [[ ! " ${ARGS[*]} " =~ " -j " ]]; then
|
||||
ARGS+=("-j" "10")
|
||||
fi
|
||||
|
||||
# Start container if not running
|
||||
docker compose -f docker/docker-compose.yml up -d
|
||||
|
||||
# Run build command (without asyncify - handled on host due to memory requirements)
|
||||
docker compose -f docker/docker-compose.yml exec kicad-wasm-builder \
|
||||
/workspace/scripts/kicad/build-pcbnew.sh "$@"
|
||||
/workspace/scripts/kicad/build-pcbnew.sh "${ARGS[@]}"
|
||||
|
||||
# Copy output to host-accessible directory
|
||||
echo "Copying build output to ./output/..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue