Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sdl_settimer(3) [opensolaris man page]

SDL_SetTimer(3) 						 SDL API Reference						   SDL_SetTimer(3)

NAME
SDL_SetTimer - Set a callback to run after the specified number of milliseconds has elapsed. SYNOPSIS
#include "SDL.h" int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); CALLBACK
/* Function prototype for the timer callback function */ typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); DESCRIPTION
Set a callback to run after the specified number of milliseconds has elapsed. The callback function is passed the current timer interval and returns the next timer interval. If the returned value is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled. To cancel a currently running timer, call SDL_SetTimer(0, NULL); The timer callback function may run in a different thread than your main constant, and so shouldn't call any functions from within itself. The maximum resolution of this timer is 10 ms, which means that if you request a 16 ms timer, your callback will run approximately 20 ms later on an unloaded system. If you wanted to set a flag signaling a frame update at 30 frames per second (every 33 ms), you might set a timer for 30 ms (see example below). If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init(). Note: This function is kept for compatibility but has been superseded by the new timer functions SDL_AddTimer and SDL_RemoveTimer which support multiple timers. EXAMPLES
SDL_SetTimer((33/10)*10, my_callback); SEE ALSO
SDL_AddTimer SDL
Tue 11 Sep 2001, 23:01 SDL_SetTimer(3)

Check Out this Related Man Page

SDL_SetTimer(3) 						 SDL API Reference						   SDL_SetTimer(3)

NAME
SDL_SetTimer - Set a callback to run after the specified number of milliseconds has elapsed. SYNOPSIS
#include "SDL.h" int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); CALLBACK
/* Function prototype for the timer callback function */ typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); DESCRIPTION
Set a callback to run after the specified number of milliseconds has elapsed. The callback function is passed the current timer interval and returns the next timer interval. If the returned value is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled. To cancel a currently running timer, call SDL_SetTimer(0, NULL); The timer callback function may run in a different thread than your main constant, and so shouldn't call any functions from within itself. The maximum resolution of this timer is 10 ms, which means that if you request a 16 ms timer, your callback will run approximately 20 ms later on an unloaded system. If you wanted to set a flag signaling a frame update at 30 frames per second (every 33 ms), you might set a timer for 30 ms (see example below). If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init(). Note: This function is kept for compatibility but has been superseded by the new timer functions SDL_AddTimer and SDL_RemoveTimer which support multiple timers. EXAMPLES
SDL_SetTimer((33/10)*10, my_callback); SEE ALSO
SDL_AddTimer SDL
Tue 11 Sep 2001, 23:01 SDL_SetTimer(3)
Man Page

5 More Discussions You Might Find Interesting

1. Programming

How to implement polling for a function using timer in C?

Hi, Can you please help me in implementing a timer based polling for function in C? ie. the function should be called in say 30secs(when 30secs has lapsed). Thanks (7 Replies)
Discussion started by: naan
7 Replies

2. Programming

Questions about timer in multi-threads environment

Hi I have questions about timer function in multi-threads environment. My application has multi-threads, in one thread, I set a timer, when the timer expires, the timer function will interrupt other thread and execute. I am not clear which thread will be interrupted by the timer function ?... (2 Replies)
Discussion started by: longskys
2 Replies

3. Linux

Socket communication and timer application

tcp communication application i have an application which run in 1) while() {in } and listens for some request When a request comes to create a file(containing some data fetch from somewhere) but i also want to start some timer that after 10/20 min delete that file But i don't know how... (0 Replies)
Discussion started by: tryit
0 Replies

4. Shell Programming and Scripting

"sed" to check file size & echo " " to destination file

Hi, I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set... (7 Replies)
Discussion started by: jockey007
7 Replies

5. Linux

Want to understand one patch

I just wanted to understand the timer patch in timer.c. It has already been merged in linux mainline kernel It says that I did not understand how it calcuates expires_limit as 0x20000000e from given value of expires=0xffffe6f5 and slack=25. Any help will be apreciable. ... (0 Replies)
Discussion started by: shivnandan kuma
0 Replies