Id like to have my console program stopped and code executed if a timer runs out. does this mean i need another thread? can anyone point me to some functions i may need to use as ive never forked a program before. im using visual c++ on windows.

Recommended Answers

All 3 Replies

No threading necessary.

See:

SetTimer()

or

CreateWaitableTimer()

with

SetWaitableTimer()
commented: good idea :) +17

You can do it creating a new thread, process or simply using a callback function. I don't use windows though, to create a thread in Linux pthread_create(), to create a new process use fork().

Use function pointers to handle callbacks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.