FlickrNet.LockFile.Release C# (CSharp) Method

Release() private method

private Release ( ) : void
return void
        internal void Release()
        {
            lock (this)
            {
            #if !WindowsCE
                // Doesn't hurt to pulse. Note that waiting threads will not actually
                // continue to execute until this critical section is exited.
                Monitor.PulseAll(this);
            #endif

                if (stream == null)
                    throw new InvalidOperationException("Tried to dispose a FileLock that was not owned");
                try
                {
                    stream.Close();
                    try
                    {
                        File.Delete(filepath);
                    } catch(IOException) { /* could fail if already acquired elsewhere */ }
                }
                finally
                {
                    stream = null;
                }
            }
        }

Usage Example

Exemplo n.º 1
0
 public void Dispose()
 {
     lockFile.Release();
 }