This repository was archived by the owner on Mar 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,9 +132,12 @@ NAN_METHOD(Request) {
132132 }
133133 adapter_thread_running.Set (true );
134134 adapter_thread = thread (Read);
135+ if (adapter_thread_running.TestAndClear ()) {
136+ adapter_thread.join ();
137+ }
135138 auto return_string = PollBytes (controller_payload);
136139 auto return_value = Nan::New<v8::String>(return_string).ToLocalChecked ();
137-
140+
138141 info.GetReturnValue ().Set (return_value);
139142}
140143NAN_METHOD (Stop) {
@@ -215,6 +218,9 @@ NAN_METHOD(Process) {
215218 }
216219 adapter_thread_running.Set (true );
217220 adapter_thread = thread (Read);
221+ if (adapter_thread_running.TestAndClear ()) {
222+ adapter_thread.join ();
223+ }
218224 Nan::HandleScope arr_scope;
219225 v8::Handle<v8::Array> arr = Nan::New<v8::Array>();
220226 for (int i = 0 ; i < 4 ; i++) {
@@ -229,6 +235,9 @@ NAN_METHOD(RawData) {
229235 }
230236 adapter_thread_running.Set (true );
231237 adapter_thread = thread (Read);
238+ if (adapter_thread_running.TestAndClear ()) {
239+ adapter_thread.join ();
240+ }
232241 stringstream return_value;
233242 return_value << " [" ;
234243 for (int i = 0 ; i < 10 ; i++) {
Original file line number Diff line number Diff line change 11{
22 "targets" : [
33 {
4- "link_settings" : {
5- "libraries" :["../lib/libusb-1.0.lib" ]
6- },
4+ "conditions" : [
5+ ["OS=='win'" ,{
6+ "link_settings" : {
7+ "libraries" :["../lib/libusb-1.0.lib" ]
8+ }
9+ }],
10+ ["OS=='linux'" , {
11+ "libraries" : ["<!@(pkg-config --libs --cflags libusb-1.0)" ]
12+ }]
13+ ],
714 "include_dirs" : [
815 "<!(node -e \" require('nan')\" )" ,
916 "include"
You can’t perform that action at this time.
0 commit comments