Multiprocessing?

This is a discussion on Multiprocessing? within the C++ Programming forums, part of the General Programming Boards category; Okay, I want to be able to do two or more things at once, and so far all I could ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    145

    Multiprocessing?

    Okay, I want to be able to do two or more things at once, and so far all I could find on the topic was multiprocessing. The problem is, I don't know how the heck to do this.
    The easiest example of what I am asking for here would be a racing game. I want the clock to tick down, even if the user sits there doing nothing, while at the same time checking to see what key they press.
    Anyhow, I am unsure how to do this and any help would be appreciated, thanks alot.
    "Um...well..."
    -Kyoto Oshiro

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,659
    For Win32 you might do:

    Code:
    DWORD WINAPI my_func(void*param){
    cout << "Thread running.";
    }
    
    HANDLE thread = CreateThread(NULL, 0, my_func, (void*)my_func_param, 0, &thread_id);
    BTW: the function must have that exact signature, whether you use the parameter or not. If you don't want to pass one ( a parameter) you can leave the 4th argument to CreateThread NULL.



    ITSA
    Socket Library!

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    145

    Thanks

    Thanks, that was the code I was looking for.
    "Um...well..."
    -Kyoto Oshiro

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    21

    FAQ material

    ^-----^

    Could someone fill in the finer details?
    I'm looking it up now.
    Last edited by anobody; 10-21-2002 at 02:00 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiprocessing variation question
    By Kyoto Oshiro in forum C++ Programming
    Replies: 4
    Last Post: 11-21-2002, 05:43 PM

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