This repository was archived by the owner on Apr 22, 2023. It is now read-only.
File tree 2 files changed +15
-5
lines changed
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,13 @@ using v8::V8;
29
29
30
30
31
31
Watchdog::Watchdog (uint64_t ms) : destroyed_(false ) {
32
- loop_ = uv_loop_new ();
32
+ int rc;
33
+ loop_ = new uv_loop_t ;
33
34
CHECK (loop_);
35
+ rc = uv_loop_init (loop_);
36
+ CHECK_EQ (0 , rc);
34
37
35
- int rc = uv_async_init (loop_, &async_, &Watchdog::Async);
38
+ rc = uv_async_init (loop_, &async_, &Watchdog::Async);
36
39
CHECK_EQ (0 , rc);
37
40
38
41
rc = uv_timer_init (loop_, &timer_);
@@ -69,7 +72,10 @@ void Watchdog::Destroy() {
69
72
// UV_RUN_DEFAULT so that libuv has a chance to clean up.
70
73
uv_run (loop_, UV_RUN_DEFAULT);
71
74
72
- uv_loop_delete (loop_);
75
+ int rc = uv_loop_close (loop_);
76
+ CHECK_EQ (0 , rc);
77
+ delete loop_;
78
+ loop_ = NULL ;
73
79
74
80
destroyed_ = true ;
75
81
}
Original file line number Diff line number Diff line change 22
22
#include " spawn_sync.h"
23
23
#include " env-inl.h"
24
24
#include " string_bytes.h"
25
+ #include " util.h"
25
26
26
27
#include < string.h>
27
28
#include < stdlib.h>
@@ -450,9 +451,10 @@ void SyncProcessRunner::TryInitializeAndRunLoop(Local<Value> options) {
450
451
assert (lifecycle_ == kUninitialized );
451
452
lifecycle_ = kInitialized ;
452
453
453
- uv_loop_ = uv_loop_new () ;
454
+ uv_loop_ = new uv_loop_t ;
454
455
if (uv_loop_ == NULL )
455
456
return SetError (UV_ENOMEM);
457
+ CHECK_EQ (uv_loop_init (uv_loop_), 0 );
456
458
457
459
r = ParseOptions (options);
458
460
if (r < 0 )
@@ -515,7 +517,9 @@ void SyncProcessRunner::CloseHandlesAndDeleteLoop() {
515
517
if (r < 0 )
516
518
abort ();
517
519
518
- uv_loop_delete (uv_loop_);
520
+ CHECK_EQ (uv_loop_close (uv_loop_), 0 );
521
+ delete uv_loop_;
522
+ uv_loop_ = NULL ;
519
523
520
524
} else {
521
525
// If the loop doesn't exist, neither should any pipes or timers.
You can’t perform that action at this time.
0 commit comments