Thread: Exiting a program when Threading

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    6

    Exiting a program when Threading

    i have program in which i start a few threads. when i run Application.Exit() the application seems to be finished but when i look in task manager its still there.

    is there some cleanup code i need to use in order to stop all threads and terminate the program

    cheers,

    GAR!

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    6
    Found the soulution on another message board

    Each thread has a property "isBackgroundThread".

    By default this property is 'false'

    If you set it to 'true' then the threads will die when the parent thread is killed.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    6
    another problem was that i was using win32 api to access the com port and i never closed the com ports.....

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    Thanks for sharing about the background thread flag. I just started using threads, but in my case the program shouldn't close until a specific set of data is processed... though it might not clean up if the program was terminated before the thread function returned... hmm... I need to take a closer look at that.

    -Rog

  5. #5
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    Thanks alot! This took me forever to figure out!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exiting program
    By ypramesh in forum C Programming
    Replies: 2
    Last Post: 04-01-2006, 03:27 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. Program exiting
    By sql.scripter in forum C Programming
    Replies: 9
    Last Post: 01-28-2006, 08:51 PM
  4. Exiting a program
    By osal in forum Windows Programming
    Replies: 2
    Last Post: 07-14-2004, 08:51 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM