Thread based timer?

Started by
5 comments, last by mikael_j 22 years, 2 months ago
I''ve been considering using a thread based timer in my next project, only problem is that I don''t know anything about threads... Anyone have any good links to throw at me? (I only found "POSIX Threads summary for experts" kind of things when searching (google)) /Mikael Jacobson
Advertisement
Win32:
[MSDN] CreateThread, [MSDN] Process and Threads

UNIX:
[IBM] Pthreads API User''s Guide and Reference, [HumanFactor] POSIX Threads Links

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
Thanks, I didn''t even look at the win32 links though (remember children, always write portable code)

/Mikael Jacobson
Performance Consideration->System Specific Code
Thread->Performance Consideration
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
If you are writing only for Win32 I''d go with the performance counter stuff.

There''s an API that can call a user-supplied callback at a specified interval.

This is likely the most efficient for Win32.

If you are concerned with portability I''d suggest abstracting the timer callback mechanism and then provide a non-Win32 implementation version based on posix threads.
I''m coding for UNIX in general and I''m trying to make it compile on windows machines as well...

/Mikael Jacobson
SDL. Look into it.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!

This topic is closed to new replies.

Advertisement