views:

449

answers:

1

1) What thread will the System.Timers.Timer's Elapsed event run on if I set the timer's SynchronizingObject property to null?

2) Will it run? What's a use case for it, if it does? I mean, in what situation will I want to run a timer on a non-UI thread/worker thread from the thread pool?

A: 

Never mind. I think I know the answers to both these questions somewhat.

a) On a worker thread from the thread pool.

b) Will it run? Probably. Will have to try it out and see. But time is a commodity. If only someone else could try it out for me.

Use case: I can think of a few. When I know the operation inside the elapsed event will never use a UI object/control/container, and I want to make the state of the function thread-safe using a lock.

Water Cooler v2