Hi all,

Need some info on "how to use or implement timers/threads/polling mechanism in c language".
Need to run the same piece of code on both platforms(windows + linux).

Can anyone of you guys suggest me something :)

Thanks in advance!

~Manoj

windows and *nix have different implementations so you can't use the same program for both.

For MS-Windows you include <windows.h>. You can use threads by calling CreateThread() in console programs, but I think it will requires a win32 windows program to successfully use the SetTimer() and KillTimer() functions because the program needs an event handling function.

I don't know what you mean by a "polling" mechanism.

windows and *nix have different implementations so you can't use the same program for both.

For MS-Windows you include <windows.h>. You can use threads by calling CreateThread() in console programs, but I think it will requires a win32 windows program to successfully use the SetTimer() and KillTimer() functions because the program needs an event handling function.

I don't know what you mean by a "polling" mechanism.

Hi,
Thanks for the quick reply!

I am a bit confused, I was under the impression that timers internally use the createThread() method and we dont have to call this method explicitly. Anyways I will check that.

One more query: Any idea about *nix, what all libraries we need to include OR what all functions we need to call (I am aware of pthread).

~ Manoj

This article has been dead for over six months. Start a new discussion instead.