Hi Dave, thanks a lot for that great example. It's a very nice implementation for syncing a bunch of blinkers. I borrowed your use of IDisposable on your LED_Extension class and followed your conservative approach to thread creation.
My final implementation (below) was slightly different because I am using a button event to turn the blinking LEDs on and off. And because I was able to get the blinking LEDs to look closely synced by only creating the blinking thread once for each LED, I was able to keep with my foreach loop approach for turning the LEDs on/off.
I also need to thank hanzibal for helping me arrive at a similar conclusion about threading.
Oh, I ended up going with a ManualResetEvent because it doesn't automatically set the state to signal when it is encountered. My Dispose() method looks a little sloppy to me and I think it can be simplified. Anyway, here is the code (I made a couple edits to it):
- JerseyTechGuy likes this