Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: refactor signal handling #480

Merged
merged 3 commits into from
Apr 9, 2024
Merged

core: refactor signal handling #480

merged 3 commits into from
Apr 9, 2024

Conversation

saghul
Copy link
Owner

@saghul saghul commented Apr 9, 2024

Replace the current signal API with one following a similar model to EventTarget, a la Deno.

Before

const sh = tjs.signal('SIGINT', handleSigInt);
// sh needs to be alive or the signal handler is destroyed.

After

tjs.addSignalListener('SIGINT', handleSigInt);
// No need to use a handle, it can be removed with
// tjs.removeSignalListener.

Fixes: #476
Ref: #477

saghul added 2 commits April 9, 2024 22:08
Replace the current signal API with one following a similar model to
EventTarget, a la Deno.

Before

```
const sh = tjs.signal('SIGINT', handleSigInt);
// sh needs to be alive or the signal handler is destroyed.
```

After

```
tjs.addSignalListener('SIGINT', handleSigInt);
// No need to use a handle, it can be removed with
// tjs.removeSignalListener.
```

Fixes: #476
Ref: #477
@saghul saghul force-pushed the refactor-signals branch from 184ecdd to 6ac9f33 Compare April 9, 2024 20:12
@saghul saghul merged commit 74c1d91 into master Apr 9, 2024
11 checks passed
@saghul saghul deleted the refactor-signals branch April 9, 2024 20:35
@saghul saghul mentioned this pull request Apr 9, 2024
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.

Signals don't work if not bound to a variable
1 participant