Coffeehouse Post

Single Post Permalink

View Thread: Question on C# Threads
  • User profile image

    , magicalclick wrote

    the dumb way is to have a static volatile int. You increment it by one before you start the thread. And in the thread, you decrement it by one at the end. And in your main thread, just brainlessly waiting the int to become 0.

    Yupe, quite dumb, but, if you are not doing anything serious, the more dumb the better. Big Smile

    It's harder to do that right (i.e. in a thread-safe way) than to just use a BackgroundWorker. Hence I would say that the BackgroundWorker is a better choice for beginners.