Threads terminate when parent process does?

This is a discussion on Threads terminate when parent process does? within the Windows Programming forums, part of the Platform Specific Boards category; I'm an uber newbie to threads in Windows...so I'm creating a test program to get the swing of things. I'm ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    80

    Threads terminate when parent process does?

    I'm an uber newbie to threads in Windows...so I'm creating a test program to get the swing of things. I'm using AfxBeginThread, and creating a few threads. I expect to see them all run to complete, but after the parent process is done creating the threads, it exits, and the child threads die.

    How do I fix this?

    Thanks!
    Andrew

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,652
    Your main thread has to wait for the child threads to complete.

    Read this: Multithreading for Rookies

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Process manipulation questions
    By Sfel in forum Windows Programming
    Replies: 7
    Last Post: 05-17-2008, 12:39 PM
  2. Terminate Process by Specific FullFilePath
    By MattKamil in forum Windows Programming
    Replies: 1
    Last Post: 07-05-2006, 04:15 PM
  3. Almost finished with Round Robin algorithm
    By Shinobi-wan in forum C++ Programming
    Replies: 2
    Last Post: 12-19-2004, 02:00 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Block and wake up certain threads
    By Spark in forum C Programming
    Replies: 9
    Last Post: 06-01-2002, 03:39 AM

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