You can include a timeout when calling Join, either in milliseconds or as a TimeSpan.
It then returns true if the thread ended or false if it timed out.
Thread.Sleep pauses the current thread for a specified period:
using System;
using System.Threading;
class ThreadTest
{
static void Main()
{
Thread.Sleep(TimeSpan.FromHours(1)); // sleep for 1 hour
Thread.Sleep(500); // sleep for 500 milliseconds
}
}
| w___ww___.j___a___v__a__2__s.___c__om___ | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |