Skip to content

Add test examples for destroy() and kill_animal() functions - #111

Closed
oligamiq wants to merge 11 commits into
bjorn3:mainfrom
oligamiq:feature/threads-destroy
Closed

Add test examples for destroy() and kill_animal() functions#111
oligamiq wants to merge 11 commits into
bjorn3:mainfrom
oligamiq:feature/threads-destroy

Conversation

@oligamiq

@oligamiq oligamiq commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Sorry, the AI has gone haywire.

oligamiq and others added 11 commits September 22, 2025 01:31
- Updated locking mechanism in better synchronization.
- Enhanced error handling for worker termination and notifications.
- Exporting example polyfill
- Adapted the example for Firefox
- Introduced a new SharedArrayBuffer for destroy status in WorkerBackground and WorkerBackgroundRef.
- Implemented destroy method to terminate all workers and close the worker context.
- Added listen_destroy method to monitor the destroy status and trigger cleanup.
- Updated worker communication to notify on errors and exits, ensuring proper resource management.
- Enhanced worker initialization to include destroy status handling.
…al management

- Removed the destroy_status property from WorkerBackground and WorkerBackgroundRef.
- Updated WorkerBackground to manage animal workers using a Map for better tracking.
- Implemented kill_animal functionality to allow termination of specific animal workers.
- Adjusted worker message handling to accommodate changes in animal management.
- Cleaned up related methods and ensured proper resource management during worker termination.
This example demonstrates the usage of WASIFarmAnimal.kill_animal() function
for terminating individual threads managed by the thread spawner.

The example includes:
- Main orchestrator (index.ts) that creates WASIFarm and coordinates test
- HTML test page (index.html) with Run Test button
- Worker thread (test_runner.ts) that creates WASIFarmAnimal and calls kill_animal()
- Thread spawning and background worker setup files

Test verifies that kill_animal() can terminate specific threads without errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@oligamiq

Copy link
Copy Markdown
Contributor Author

Closing this PR - created by mistake. Development branch is maintained at oligamiq/browser_wasi_shim.

@oligamiq oligamiq closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant