Is it posibble to have a count-down timer while I'm doing something else in the console? it's a simple game wherein a specified time is allowed for the player..if possible, how? I created a timer but it waits until it finishes before proceding to the game..tnx in advance

8 Years
Discussion Span
Last Post by c++ prog

so it can be done using multithreading...and i don't even have any idea how to do one! lol...maybe i'll just scrap the timer idea on the game..but tnx anyways for your response


Creating another thread is pretty trivial, depending on the operating system. For example, in MS-Windows just call CreateThread() leaving most parameter values 0.

#include <windows.h>

DWORD WINAPI ThreadProc(void* lpParameter)
    // put your timer code here

    return 0;

int main()
      DWORD ThreadID = 0;
      CreateThread(0,0, ThreadProc, 0, 0, &ThreadID);


but we haven't discussed it yet those..I don't have any idea.. and I think it's already an advanced programming... so my professor will understand my situation. Anyway, I revised the game and it still looks fine even without the timer...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.