This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
tests/src/baseservices/threading/mutex/misc Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -422,18 +422,17 @@ public bool NegTest1()
422422 public bool NegTest2 ( )
423423 {
424424 bool retVal = true ;
425- Thread thread = null ;
426425
427426 TestLibrary . TestFramework . BeginScenario ( "NegTest2: ObjectDisposedException should be thrown if current instance has already been disposed" ) ;
428427
429428 try
430429 {
431430 m_Mutex = new Mutex ( ) ;
432431
433- thread = new Thread ( new ThreadStart ( DisposeMutex ) ) ;
432+ var thread = new Thread ( new ThreadStart ( DisposeMutex ) ) ;
433+ thread . IsBackground = true ;
434434 thread . Start ( ) ;
435- Thread . Sleep ( c_DEFAULT_SLEEP_TIME / 5 ) ; // To avoid race
436- Thread . Sleep ( c_DEFAULT_SLEEP_TIME ) ;
435+ thread . Join ( ) ;
437436 m_Mutex . WaitOne ( Timeout . Infinite ) ;
438437
439438 TestLibrary . TestFramework . LogError ( "103" , "ObjectDisposedException is not thrown if current instance has already been disposed" ) ;
@@ -450,11 +449,6 @@ public bool NegTest2()
450449 }
451450 finally
452451 {
453- if ( null != thread )
454- {
455- thread . Join ( ) ;
456- }
457-
458452 if ( null != m_Mutex )
459453 {
460454 ( ( IDisposable ) m_Mutex ) . Dispose ( ) ;
@@ -558,7 +552,6 @@ private void NeverReleaseMutex()
558552
559553 private void DisposeMutex ( )
560554 {
561- Thread . Sleep ( c_DEFAULT_SLEEP_TIME ) ;
562555 ( ( IDisposable ) m_Mutex ) . Dispose ( ) ;
563556 }
564557
You can’t perform that action at this time.
0 commit comments