Exiting a program when Threading

This is a discussion on Exiting a program when Threading within the C# Programming forums, part of the General Programming Boards category; i have program in which i start a few threads. when i run Application.Exit() the application seems to be finished ...

  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
    Rog
    Rog is offline
    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, 02:27 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 06:49 PM
  3. Program exiting
    By sql.scripter in forum C Programming
    Replies: 9
    Last Post: 01-28-2006, 07: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21