Thread: Amateur Threading Question

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    4

    Amateur Threading Question

    I have a feeling that I can't figure this one out for myself just 'cause I'm tired again but what the hey at least this one's a quick'un:

    So I've made a thread within Main and I've started it up, it's all working funky but now I want to be able to detect when Main has finished executing from the newly started thread.

    I know I need to use IsAlive but I'm not sure how to refer to Main or what the name of Main's thread is, if that makes sense?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    System.Threading.Thread.CurrentThread returns the currently running thread. Store this at beginning of main, and reference it from your secondary thread.
    Though it sounds a bit odd doing what you do. The main thread should generally be the first and last thread running.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  2. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. very amateur question:
    By jemer in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2003, 02:41 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM