Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class InternalClass{ Thread t = null; public InternalClass() {
- t = new Thread( new ThreadStart( ThreadFunction ) ); t.Start(); }
- /// Internal Thread Function private void ThreadFunction() {
- // Simulate startup Thread.Sleep( 10000 );
- Console.WriteLine( "ThreadFunction Startup Complete trying to call lock(this)" );
- // loop forever while( true ) { lock(this) {
- Console.WriteLine( "Running Internal ThreadFunction - Starting(takes 3 seconds)" );
- // do some work Thread.Sleep( 3000 );
- Console.WriteLine( "Running Internal ThreadFunction - Complete" ); } } }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement