public void Stop() { if (!_isRunning) { return; } _isRunning = false; #if UNITY_EDITOR _polster.Join(); #else _polster.Wait(); #endif LeapC.CloseConnection(_leapConnection); }
public void Stop() { if (!_isRunning) return; _isRunning = false; //Very important to close the connection before we try to join the //worker thread! The call to PollConnection can sometimes block, //despite the timeout, causing an attempt to join the thread waiting //forever and preventing the connection from stopping. // //It seems that closing the connection causes PollConnection to //unblock in these cases, so just make sure to close the connection //before trying to join the worker thread. LeapC.CloseConnection(_leapConnection); _polster.Join(); }