Console.WriteLine("Waiting...");
int i = WaitHandle.WaitAny(
new WaitHandle[]{myMutex,
- new ManualResetEvent(false)}, 10000);
+ new ManualResetEvent(false)}, 30000);
Console.WriteLine("WaitAny did not throw an " +
"exception, i = " + i);
}
private void AbandonAllMutexesWait()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
else
((ManualResetEvent)w).Set();
wh[i] = new ManualResetEvent(false);
}
}
-}
\ No newline at end of file
+}
private void AbandonAllMutexesWait()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
else
((ManualResetEvent)w).Set();
wh[i] = new ManualResetEvent(false);
}
}
-}
\ No newline at end of file
+}
try
{
Console.WriteLine("Waiting...");
- int i = WaitHandle.WaitAny(wh, 10000);
+ int i = WaitHandle.WaitAny(wh, 30000);
Console.WriteLine("WaitAny did not throw an " +
"exception, i = " + i);
}
private void AbandonAllMutexes()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
}
myMRE.Set();
private void AbandonAllMutexes()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
}
myMRE.Set();
}
}
}
-}
\ No newline at end of file
+}
try
{
Console.WriteLine("Waiting...");
- i = WaitHandle.WaitAny(wh, 5000);
- Console.WriteLine("WaitAny did not throw AbandonedMutexExcpetion");
+ i = WaitHandle.WaitAny(wh, 30000);
+ Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
}
catch(AbandonedMutexException)
{
private void AbandonOneAndRelease()
{
- Mutex m = new Mutex();
bool bSet = false;
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
{
w.WaitOne();
if(bSet)
{
Console.WriteLine("Waiting...");
i = WaitHandle.WaitAny(wh);
- Console.WriteLine("WaitAny did not throw AbandonedMutexExcpetion");
+ Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
}
catch(AbandonedMutexException)
{
private void AbandonOneAndRelease()
{
- Mutex m = new Mutex();
bool bSet = false;
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
{
w.WaitOne();
if(bSet)
try
{
Console.WriteLine("Waiting...");
- i = WaitHandle.WaitAny(wh, 5000);
if(0 == iPosToAbandon)
- Console.WriteLine("WaitAny didn't return an " +
- "AbandonedMutexException");
+ {
+ i = WaitHandle.WaitAny(wh, 30000);
+ Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
+ }
else
+ {
+ i = WaitHandle.WaitAny(wh, 10000);
// Expected to pass
iRet = 100;
+ }
}
catch(AbandonedMutexException)
{
wh[i] = new Mutex(false, Common.GetUniqueName());
}
}
-}
\ No newline at end of file
+}
try
{
Console.WriteLine("Waiting...");
- int i = WaitHandle.WaitAny(wh, 10000);
+ int i = WaitHandle.WaitAny(wh, 30000);
Console.WriteLine("WaitAny did not throw an " +
"exception, i = " + i);
}
private void AbandonAllMutexes()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
}
myMRE.Set();
private void AbandonAllMutexes()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
}
myMRE.Set();
try
{
Console.WriteLine("Waiting...");
- int i = WaitHandle.WaitAny(wh, 5000);
+ int i = WaitHandle.WaitAny(wh, 30000);
Console.WriteLine("WaitAny did not throw an " +
"exception, i = " + i);
}
try
{
Console.WriteLine("Waiting...");
- int i = WaitHandle.WaitAny(wh, 10000);
+ int i = WaitHandle.WaitAny(wh, 30000);
Console.WriteLine("WaitAny did not throw an " +
"exception, i = " + i);
}
private void AbandonAllMutexesWait()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
}
myMRE.Set();
wh[i] = new ManualResetEvent(false);
}
}
-}
\ No newline at end of file
+}
private void AbandonAllMutexesWait()
{
- Mutex m = new Mutex();
foreach(WaitHandle w in wh)
{
- if(w.GetType() == m.GetType())
+ if(w is Mutex)
w.WaitOne();
}
myMRE.Set();
wh[i] = new ManualResetEvent(false);
}
}
-}
\ No newline at end of file
+}