when using a lock does the thing you are locking on have to be a object. For example is this legal
static DateTime NextCleanup = DateTime.Now;
const TimeSpan CleanupInterval = new TimeSpan(1, 0, 0);
private static void DoCleanup()
{
lock ((object)NextCleanup)
{
if (NextCleanup < DateTime.Now)
{
NextCleanup = DateTime.Now.Add(CleanupInterval);
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(cleanupThread));
}
}
return;
}