Accord.Video.Kinect.KinectNative.freenect_close_device C# (CSharp) Method

freenect_close_device() private method

private freenect_close_device ( IntPtr device ) : int
device System.IntPtr
return int
        public static extern int freenect_close_device(IntPtr device);

Usage Example

Beispiel #1
0
        private void Dispose(bool disposing)
        {
            lock (sync)
            {
                if (rawDevice == IntPtr.Zero)
                {
                    return;
                }

                bool needToStopStatusThread = false;

                lock (openDevices)
                {
                    // decrease reference counter and check if we need to close the device
                    if (--openDevices[deviceID].ReferenceCounter == 0)
                    {
                        if (!openDevices[deviceID].DeviceFailed)
                        {
                            KinectNative.freenect_close_device(rawDevice);
                        }
                        openDevices.Remove(deviceID);
                    }

                    needToStopStatusThread = (openDevices.Count == 0);
                }

                rawDevice = IntPtr.Zero;

                if (needToStopStatusThread)
                {
                    StopStatusThread();
                }
            }

            KinectNative.OnError -= new KinectNative.ErrorHandler(Kinect_OnError);
        }