Commit 8d222d4
n-api: add helper for addons to get the event loop
Add a utility functions for addons to use when they need
a reference to the current event loop.
While the libuv API is not directly part of N-API, it
provides a quite stable C API as well, and is tightly
integrated with Node itself.
As a particular use case, without access to the event loop
it is hard to do something interesting from inside a N-API
finalizer function, since calls into JS and therefore virtually
all other N-API functions are not allowed.
PR-URL: #17109
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>1 parent 84b7070 commit 8d222d4Copy full SHA for 8d222d4
File tree
Expand file treeCollapse file tree
7 files changed
+134
-10
lines changedOpen diff view settings
Filter options
- doc/api
- src
- test/addons-napi
- test_general
- test_uv_loop
Expand file treeCollapse file tree
7 files changed
+134
-10
lines changedOpen diff view settings
Collapse file
+17Lines changed: 17 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3686 | 3686 | |
3687 | 3687 | |
3688 | 3688 | |
| 3689 | + |
| 3690 | + |
| 3691 | + |
| 3692 | + |
| 3693 | + |
| 3694 | + |
| 3695 | + |
| 3696 | + |
| 3697 | + |
| 3698 | + |
| 3699 | + |
| 3700 | + |
| 3701 | + |
| 3702 | + |
| 3703 | + |
| 3704 | + |
| 3705 | + |
3689 | 3706 | |
3690 | 3707 | |
3691 | 3708 | |
|
Collapse file
+19-9Lines changed: 19 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | | - |
| 21 | + |
22 | 22 | |
23 | 23 | |
24 | 24 | |
| ||
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | | - |
32 | | - |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
33 | 35 | |
34 | 36 | |
35 | 37 | |
| ||
43 | 45 | |
44 | 46 | |
45 | 47 | |
| 48 | + |
46 | 49 | |
47 | 50 | |
48 | 51 | |
| ||
771 | 774 | |
772 | 775 | |
773 | 776 | |
774 | | - |
| 777 | + |
775 | 778 | |
776 | 779 | |
777 | 780 | |
| ||
3401 | 3404 | |
3402 | 3405 | |
3403 | 3406 | |
| 3407 | + |
| 3408 | + |
| 3409 | + |
| 3410 | + |
| 3411 | + |
| 3412 | + |
| 3413 | + |
3404 | 3414 | |
3405 | 3415 | |
3406 | 3416 | |
3407 | 3417 | |
3408 | | - |
3409 | | - |
3410 | | - |
3411 | | - |
3412 | | - |
| 3418 | + |
| 3419 | + |
| 3420 | + |
| 3421 | + |
| 3422 | + |
3413 | 3423 | |
3414 | 3424 | |
3415 | 3425 | |
|
Collapse file
+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
14 | 14 | |
15 | 15 | |
16 | 16 | |
| 17 | + |
| 18 | + |
17 | 19 | |
18 | 20 | |
19 | 21 | |
| ||
581 | 583 | |
582 | 584 | |
583 | 585 | |
| 586 | + |
| 587 | + |
| 588 | + |
| 589 | + |
584 | 590 | |
585 | 591 | |
586 | 592 | |
Collapse file
test/addons-napi/test_general/test.js
Copy file name to clipboardExpand all lines: test/addons-napi/test_general/test.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
34 | 34 | |
35 | 35 | |
36 | 36 | |
37 | | - |
| 37 | + |
38 | 38 | |
39 | 39 | |
40 | 40 | |
|
Collapse file
test/addons-napi/test_uv_loop/binding.gyp
Copy file name to clipboard+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
Collapse file
test/addons-napi/test_uv_loop/test.js
Copy file name to clipboard+5Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
Collapse file
test/addons-napi/test_uv_loop/test_uv_loop.cc
Copy file name to clipboard+78Lines changed: 78 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
0 commit comments