Skip to content

core: refactor signal handling#480

Merged
saghul merged 3 commits intomasterfrom
refactor-signals
Apr 9, 2024
Merged

core: refactor signal handling#480
saghul merged 3 commits intomasterfrom
refactor-signals

Conversation

@saghul
Copy link
Copy Markdown
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
@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