@@ -127,7 +127,7 @@ NAN_METHOD(Database::New) {
127127 callback = Local<Function>::Cast (info[pos++]);
128128 }
129129
130- Database* db = new Database ();
130+ Database* db = new Database (node::GetCurrentEventLoop (info. GetIsolate ()) );
131131 db->Wrap (info.This ());
132132
133133 Nan::ForceSet (info.This (), Nan::New (" filename" ).ToLocalChecked (), info[0 ].As <String>(), ReadOnly);
@@ -141,7 +141,7 @@ NAN_METHOD(Database::New) {
141141}
142142
143143void Database::Work_BeginOpen (Baton* baton) {
144- int status = uv_queue_work (uv_default_loop () ,
144+ int status = uv_queue_work (baton-> db -> loop ,
145145 &baton->request , Work_Open, (uv_after_work_cb)Work_AfterOpen);
146146 assert (status == 0 );
147147}
@@ -227,7 +227,7 @@ void Database::Work_BeginClose(Baton* baton) {
227227 baton->db ->RemoveCallbacks ();
228228 baton->db ->closing = true ;
229229
230- int status = uv_queue_work (uv_default_loop () ,
230+ int status = uv_queue_work (baton-> db -> loop ,
231231 &baton->request , Work_Close, (uv_after_work_cb)Work_AfterClose);
232232 assert (status == 0 );
233233}
@@ -388,7 +388,7 @@ void Database::RegisterTraceCallback(Baton* baton) {
388388
389389 if (db->debug_trace == NULL ) {
390390 // Add it.
391- db->debug_trace = new AsyncTrace (db, TraceCallback);
391+ db->debug_trace = new AsyncTrace (db-> loop , db , TraceCallback);
392392 sqlite3_trace (db->_handle , TraceCallback, db);
393393 }
394394 else {
@@ -426,7 +426,7 @@ void Database::RegisterProfileCallback(Baton* baton) {
426426
427427 if (db->debug_profile == NULL ) {
428428 // Add it.
429- db->debug_profile = new AsyncProfile (db, ProfileCallback);
429+ db->debug_profile = new AsyncProfile (db-> loop , db , ProfileCallback);
430430 sqlite3_profile (db->_handle , ProfileCallback, db);
431431 }
432432 else {
@@ -467,7 +467,7 @@ void Database::RegisterUpdateCallback(Baton* baton) {
467467
468468 if (db->update_event == NULL ) {
469469 // Add it.
470- db->update_event = new AsyncUpdate (db, UpdateCallback);
470+ db->update_event = new AsyncUpdate (db-> loop , db , UpdateCallback);
471471 sqlite3_update_hook (db->_handle , UpdateCallback, db);
472472 }
473473 else {
@@ -522,7 +522,7 @@ void Database::Work_BeginExec(Baton* baton) {
522522 assert (baton->db ->open );
523523 assert (baton->db ->_handle );
524524 assert (baton->db ->pending == 0 );
525- int status = uv_queue_work (uv_default_loop () ,
525+ int status = uv_queue_work (baton-> db -> loop ,
526526 &baton->request , Work_Exec, (uv_after_work_cb)Work_AfterExec);
527527 assert (status == 0 );
528528}
@@ -622,7 +622,7 @@ void Database::Work_BeginLoadExtension(Baton* baton) {
622622 assert (baton->db ->open );
623623 assert (baton->db ->_handle );
624624 assert (baton->db ->pending == 0 );
625- int status = uv_queue_work (uv_default_loop () ,
625+ int status = uv_queue_work (baton-> db -> loop ,
626626 &baton->request , Work_LoadExtension, reinterpret_cast <uv_after_work_cb>(Work_AfterLoadExtension));
627627 assert (status == 0 );
628628}
0 commit comments