Skip to content

Commit dfee682

Browse files
stoprocentdnicolsonclaude
authored
fix: thread cleanup in destructor and Stop method (#17)
Ensure polling thread is properly stopped and joined before cleanup. Co-authored-by: Dave Nicolson <david.nicolson@gmail.com> Co-authored-by: Claude <claude@anthropic.com>
1 parent a132f8e commit dfee682

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/BluetoothHciSocket.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,11 @@ void BluetoothHciSocket::SetFilter(const Napi::CallbackInfo& info) {
583583
}
584584

585585
void BluetoothHciSocket::Start(const Napi::CallbackInfo& info) {
586+
if (!stopFlag && pollingThread.joinable()) {
587+
stopFlag = true;
588+
pollingThread.join();
589+
}
590+
586591
if (!this->EnsureSocket(info)) {
587592
return;
588593
}

0 commit comments

Comments
 (0)