Anna Henningsen
d659ed6dbe
worker: refactor worker.terminate()
...
At the collaborator summit in Berlin, the behaviour of
`worker.terminate()` was discussed.
In particular, switching from a callback-based to a Promise-based API
was suggested. While investigating that possibility later, it was
discovered that `.terminate()` was unintentionally synchronous up
until now (including calling its callback synchronously).
Also, the topic of its stability has been brought up. I have performed
two manual reviews of the native codebase for compatibility with
`.terminate()`, and performed some manual fuzz testing with the test
suite. At this point, bugs with `.terminate()` should, in my opinion,
be treated like bugs in other Node.js features.
(It is possible to make Node.js crash with `.terminate()` by messing
with internals and/or built-in prototype objects, but that is already
the case without `.terminate()` as well.)
This commit:
- Makes `.terminate()` an asynchronous operation.
- Makes `.terminate()` return a `Promise`.
- Runtime-deprecates passing a callback.
- Removes a warning about its stability from the documentation.
- Eliminates an unnecessary extra function from the C++ code.
A possible alternative to returning a `Promise` would be to keep the
method synchronous and just drop the callback. Generally, providing
an asynchronous API does provide us with a bit more flexibility.
Refs: https://github.com/nodejs/summit/issues/141
PR-URL: https://github.com/nodejs/node/pull/28021
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-06-18 16:04:10 +02:00
..
2019-06-18 16:03:14 +02:00
2019-06-17 21:12:09 +02:00
2019-04-29 16:57:28 +02:00
2019-06-17 21:12:25 +02:00
2019-05-07 20:37:38 +02:00
2019-06-17 21:12:26 +02:00
2019-04-01 21:04:09 +08:00
2019-05-13 18:12:43 +02:00
2019-05-05 12:43:15 +02:00
2019-04-09 13:57:04 -07:00
2019-05-22 10:18:22 +02:00
2019-04-15 17:21:34 +02:00
2019-05-01 14:45:51 +02:00
2019-04-15 17:21:34 +02:00
2019-04-04 14:21:11 +02:00
2019-05-13 18:12:43 +02:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-04-15 17:21:34 +02:00
2019-03-30 13:28:24 +01:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-04-08 08:55:46 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-15 17:21:34 +02:00
2019-05-01 14:45:51 +02:00
2019-05-01 14:45:51 +02:00
2019-03-30 13:30:15 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-17 14:05:15 -07:00
2019-04-17 14:05:15 -07:00
2019-06-17 21:12:23 +02:00
2019-04-17 14:05:15 -07:00
2019-04-12 08:54:13 +08:00
2019-04-18 05:24:19 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-28 07:33:24 +02:00
2019-04-29 16:57:37 +02:00
2019-05-13 18:12:43 +02:00
2019-05-21 13:13:24 +02:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-04-17 14:05:15 -07:00
2019-03-27 17:20:06 +01:00
2019-04-29 16:57:37 +02:00
2019-04-29 16:57:37 +02:00
2019-03-27 17:05:15 +01:00
2019-06-18 16:04:10 +02:00
2019-04-17 19:46:00 +02:00
2019-04-16 12:41:59 -04:00
2019-04-16 12:41:59 -04:00
2019-03-27 17:20:06 +01:00
2019-06-02 15:15:25 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-22 14:48:50 -04:00
2019-06-17 19:49:54 +02:00
2019-04-10 17:59:14 +02:00
2019-05-31 08:46:55 +02:00
2019-04-10 17:59:14 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:15 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-28 14:03:18 -07:00
2019-06-17 21:12:15 +02:00
2019-05-31 08:47:03 +02:00
2019-05-28 07:33:35 +02:00
2019-03-27 17:20:06 +01:00
2019-03-28 14:03:18 -07:00
2019-05-01 14:45:51 +02:00
2019-04-04 12:51:03 +02:00
2019-06-17 21:12:16 +02:00
2019-03-27 17:20:06 +01:00
2019-06-17 21:12:16 +02:00
2019-03-28 14:03:18 -07:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-29 16:57:33 +02:00
2019-04-29 16:57:35 +02:00
2019-04-03 06:48:13 +02:00
2019-04-03 06:48:13 +02:00
2019-04-03 06:48:13 +02:00
2019-04-03 06:48:13 +02:00
2019-04-03 06:48:13 +02:00
2019-04-30 08:17:34 +02:00
2019-04-03 06:48:13 +02:00
2019-05-14 17:33:07 +02:00
2019-05-13 18:12:43 +02:00
2019-04-29 16:57:35 +02:00
2019-04-29 16:57:35 +02:00
2019-06-17 21:12:13 +02:00
2019-04-20 19:05:39 -07:00
2019-04-27 11:36:02 +02:00
2019-04-01 16:58:25 -07:00
2019-05-17 08:13:32 +02:00
2019-05-13 18:12:43 +02:00
2019-05-14 17:33:06 +02:00
2019-05-17 08:13:35 +02:00
2019-05-17 08:13:35 +02:00
2019-05-17 08:13:35 +02:00
2019-05-01 14:45:51 +02:00
2019-05-18 13:59:51 +02:00
2019-03-27 17:20:06 +01:00
2019-05-01 14:45:51 +02:00
2019-04-16 03:37:03 +02:00
2019-04-16 03:37:03 +02:00
2019-05-11 11:14:15 +02:00
2019-04-29 16:57:34 +02:00
2019-03-27 17:20:06 +01:00
2019-04-16 13:59:50 -04:00
2019-04-08 21:16:56 -04:00
2019-06-03 13:14:24 +02:00
2019-04-29 16:57:35 +02:00
2019-04-29 16:57:36 +02:00
2019-04-30 17:47:26 +02:00
2019-05-04 09:20:18 +02:00
2019-04-04 12:51:03 +02:00
2019-04-29 16:57:28 +02:00
2019-04-30 17:47:26 +02:00
2019-04-29 16:57:34 +02:00
2019-04-29 16:57:33 +02:00
2019-04-29 16:57:37 +02:00
2019-04-30 08:17:34 +02:00
2019-03-27 17:20:06 +01:00
2019-05-31 08:46:56 +02:00
2019-05-23 16:15:28 +02:00
2019-05-13 18:12:43 +02:00
2019-03-26 15:26:07 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-06-17 21:12:12 +02:00
2019-04-04 12:51:03 +02:00
2019-04-04 12:51:03 +02:00
2019-03-27 17:20:06 +01:00
2019-05-13 18:12:43 +02:00
2019-04-04 12:51:03 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-20 13:20:13 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-31 08:46:52 +02:00
2019-05-31 08:46:52 +02:00
2019-05-28 07:33:35 +02:00
2019-05-28 07:33:37 +02:00
2019-04-04 12:51:03 +02:00
2019-04-04 12:51:03 +02:00
2019-04-04 12:51:03 +02:00
2019-05-28 07:47:52 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-10 17:59:14 +02:00
2019-04-04 12:51:03 +02:00
2019-05-05 12:43:00 +02:00
2019-04-30 17:47:26 +02:00
2019-04-30 17:47:25 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-09 21:56:29 +02:00
2019-05-20 13:20:19 +02:00
2019-03-27 17:20:06 +01:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-05-04 09:20:21 +02:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-20 13:20:19 +02:00
2019-06-01 18:29:47 +02:00
2019-05-04 09:20:22 +02:00
2019-05-13 18:12:43 +02:00
2019-05-04 09:20:22 +02:00
2019-03-27 17:20:06 +01:00
2019-04-04 12:48:57 +02:00
2019-05-28 07:33:36 +02:00
2019-05-20 13:20:19 +02:00
2019-06-02 15:15:23 +02:00
2019-03-27 17:20:06 +01:00
2019-05-01 14:45:49 +02:00
2019-05-23 13:19:47 -07:00
2019-05-28 07:33:35 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-28 07:33:31 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-06-17 21:12:13 +02:00
2019-04-30 17:47:27 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:17 +02:00
2019-06-17 21:12:16 +02:00
2019-06-18 16:04:10 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-06-17 21:12:16 +02:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-06-17 19:49:40 +02:00
2019-05-14 17:33:08 +02:00
2019-05-18 13:59:51 +02:00
2019-05-15 17:11:52 +02:00
2019-04-27 11:36:04 +02:00
2019-04-27 11:36:04 +02:00
2019-05-01 14:45:51 +02:00
2019-04-27 12:05:19 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-06 13:09:45 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-04 09:20:18 +02:00
2019-05-14 17:33:02 +02:00
2019-03-27 17:11:53 +01:00
2019-03-27 15:52:11 -04:00
2019-04-08 18:56:17 +02:00
2019-03-30 13:13:42 +01:00
2019-04-30 08:17:33 +02:00
2019-05-28 07:33:36 +02:00
2019-04-29 16:57:33 +02:00
2019-05-01 14:45:51 +02:00
2019-04-29 16:57:34 +02:00
2019-04-29 16:57:32 +02:00
2019-03-27 17:20:06 +01:00
2019-04-30 17:47:26 +02:00
2019-04-29 16:57:33 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-04 12:51:03 +02:00
2019-06-17 19:49:43 +02:00
2019-04-15 18:29:07 +02:00
2019-05-13 18:12:43 +02:00
2019-03-28 12:22:21 +01:00
2019-03-27 17:20:06 +01:00
2019-05-28 07:33:36 +02:00
2019-04-04 12:51:03 +02:00
2019-04-30 08:17:34 +02:00
2019-04-16 03:37:03 +02:00
2019-05-05 12:40:37 +02:00
2019-05-05 12:40:37 +02:00
2019-06-18 16:03:15 +02:00
2019-05-13 18:12:43 +02:00
2019-05-18 13:59:51 +02:00
2019-04-22 14:48:50 -04:00
2019-03-27 17:20:06 +01:00
2019-04-04 12:51:03 +02:00
2019-03-27 17:20:06 +01:00
2019-04-15 18:29:07 +02:00
2019-04-15 18:29:07 +02:00
2019-04-15 18:29:07 +02:00
2019-04-15 18:29:07 +02:00
2019-04-15 18:29:07 +02:00
2019-04-15 18:29:07 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-18 13:59:51 +02:00
2019-03-30 13:34:39 +01:00
2019-03-27 17:20:06 +01:00
2019-05-13 18:12:43 +02:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-05-13 18:12:42 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-16 03:37:03 +02:00
2019-04-16 03:37:03 +02:00
2019-03-27 17:20:06 +01:00
2019-05-09 18:43:57 +02:00
2019-04-10 17:59:14 +02:00
2019-04-16 03:37:03 +02:00
2019-04-16 03:37:03 +02:00
2019-03-27 17:20:06 +01:00
2019-04-29 16:57:34 +02:00
2019-05-09 18:43:57 +02:00
2019-05-09 18:43:57 +02:00
2019-05-09 18:43:57 +02:00
2019-04-10 17:59:14 +02:00
2019-04-16 03:37:03 +02:00
2019-05-06 13:00:54 +02:00
2019-04-03 02:28:24 +02:00
2019-03-27 17:11:53 +01:00
2019-03-27 17:20:06 +01:00
2019-05-04 09:20:23 +02:00
2019-03-27 17:20:06 +01:00
2019-05-20 13:20:18 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-08 22:40:15 +08:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-10 02:52:43 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-03-31 14:09:35 +02:00
2019-05-31 08:46:56 +02:00
2019-06-03 13:14:24 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-04 12:48:57 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-04-09 13:57:04 -07:00
2019-04-15 18:29:07 +02:00
2019-03-27 17:20:06 +01:00
2019-04-04 12:51:03 +02:00
2019-03-27 17:20:06 +01:00
2019-04-15 18:29:07 +02:00
2019-03-27 17:20:06 +01:00
2019-06-17 21:12:16 +02:00
2019-04-27 11:36:04 +02:00
2019-06-17 19:49:43 +02:00
2019-05-04 09:20:23 +02:00
2019-05-06 13:02:05 +02:00
2019-06-17 21:12:16 +02:00
2019-04-01 09:14:17 -04:00
2019-06-17 21:12:16 +02:00
2019-03-28 14:03:25 -07:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-05-28 07:33:31 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-06-17 19:49:53 +02:00
2019-04-30 08:17:33 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:17 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-05-09 18:43:53 +02:00
2019-06-17 21:12:17 +02:00
2019-05-09 18:43:57 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-04-27 11:36:08 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:17 +02:00
2019-05-20 13:20:20 +02:00
2019-06-17 21:12:16 +02:00
2019-06-17 21:12:17 +02:00
2019-05-20 13:20:16 +02:00
2019-06-17 21:12:17 +02:00
2019-05-11 11:14:15 +02:00
2019-04-27 11:36:05 +02:00
2019-05-04 09:20:18 +02:00
2019-05-23 16:15:12 +02:00
2019-03-27 17:20:06 +01:00
2019-06-17 21:12:17 +02:00
2019-06-17 21:12:16 +02:00
2019-04-04 15:35:02 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-30 13:05:31 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 22:45:20 +01:00
2019-05-20 15:03:27 +02:00
2019-05-06 13:00:54 +02:00
2019-06-18 16:03:17 +02:00
2019-03-27 17:20:06 +01:00
2019-04-22 18:43:40 +08:00
2019-03-27 17:20:06 +01:00
2019-05-13 18:12:43 +02:00
2019-05-31 08:46:56 +02:00
2019-04-27 11:36:02 +02:00
2019-03-27 17:20:06 +01:00
2019-05-31 08:46:53 +02:00
2019-05-13 18:12:37 +02:00
2019-04-05 05:44:51 +02:00
2019-06-17 21:12:16 +02:00
2019-04-10 17:59:14 +02:00
2019-04-10 17:59:14 +02:00
2019-03-27 17:20:06 +01:00
2019-05-17 08:13:33 +02:00
2019-06-17 19:49:55 +02:00
2019-06-18 16:04:10 +02:00
2019-04-27 11:36:02 +02:00
2019-04-08 12:17:48 -04:00
2019-06-03 13:14:25 +02:00
2019-06-17 21:12:27 +02:00
2019-05-18 13:59:50 +02:00
2019-06-17 21:12:27 +02:00
2019-05-20 13:20:16 +02:00
2019-06-17 21:12:12 +02:00
2019-06-17 19:49:45 +02:00
2019-06-17 21:12:12 +02:00
2019-06-03 13:14:25 +02:00
2019-06-18 16:04:10 +02:00
2019-05-13 18:12:43 +02:00
2019-05-13 18:12:43 +02:00
2019-03-30 22:25:35 +01:00
2019-03-30 22:25:35 +01:00
2019-06-04 18:46:17 +02:00
2019-05-13 18:12:43 +02:00
2019-05-13 18:12:43 +02:00
2019-05-13 18:12:43 +02:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00
2019-03-27 17:20:06 +01:00