| 126 | } |
| 127 | |
| 128 | static Value StopThread(const CallbackInfo& info) { |
| 129 | tsfnInfo.jsFinalizeCallback = Napi::Persistent(info[0].As<Function>()); |
| 130 | bool abort = info[1].As<Boolean>(); |
| 131 | if (abort) { |
| 132 | s_tsfn.Abort(); |
| 133 | } else { |
| 134 | s_tsfn.Release(); |
| 135 | } |
| 136 | { |
| 137 | std::lock_guard<std::mutex> _(tsfnInfo.protect); |
| 138 | tsfnInfo.closeCalledFromJs = true; |
| 139 | tsfnInfo.signal.notify_one(); |
| 140 | } |
| 141 | return Value(); |
| 142 | } |
| 143 | |
| 144 | // Join the thread and inform JS that we're done. |
| 145 | static void JoinTheThreads(Env /* env */, |
nothing calls this directly
no test coverage detected