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;
}
}
}