public static void Close() { servicePipe = null; running = false; ThreadHelper.CancelSynchronousIo(threadID); serviceReceiver.Dispose(); service.Close(); }
void OnDestroy() { Log("Stopping listening to bone data"); listener.KinectService.StopListeningBoneData(); running = false; ThreadHelper.CancelSynchronousIo(threadID); Log("Closing the listener pipe"); listenerReceiver.Dispose(); Log("Closing the service pipe"); Close(); Log("Freeing the library"); NativeUtil.FreeLibrary(nativeLibrary); }