Hi!
I wanted a timer that expires after the first interval. Therefore I used
SDL_SetTimer(msecs, my_timer_callback).
When I call SDL_SetTimer(0, NULL) in the timercallback, I alway got a segfault.
Accidentally I returned 0 in the timercallback function and now it works. But
I don’t think that this is the default behaviour.
If this is not a bug, it should be documented. And how do I implement this
with SDL_AddTimer. The return 0 trick doesn’t work (so I think this is a bug).
And calling SDL_RemoveTimer even doesn’t work in the callback.
Bye
Thomas
I wanted a timer that expires after the first interval. Therefore I
used
SDL_SetTimer(msecs, my_timer_callback).
When I call SDL_SetTimer(0, NULL) in the timercallback, I alway got a
segfault.
Accidentally I returned 0 in the timercallback function and now it
works. But
I don’t think that this is the default behaviour.
If this is not a bug, it should be documented. And how do I implement
this
with SDL_AddTimer. The return 0 trick doesn’t work (so I think this is
a bug).
And calling SDL_RemoveTimer even doesn’t work in the callback.
I think if your SDL_AddTimer( ) callback returns a negative value,
the timer stops. (Hope it wasn’t just a bug in my code! )
M.C.
I wanted a timer that expires after the first interval. Therefore I
used
SDL_SetTimer(msecs, my_timer_callback).
When I call SDL_SetTimer(0, NULL) in the timercallback, I alway got a
segfault.
Accidentally I returned 0 in the timercallback function and now it
works. But
I don’t think that this is the default behaviour.
If this is not a bug, it should be documented. And how do I implement
this
with SDL_AddTimer. The return 0 trick doesn’t work (so I think this is
a bug).
And calling SDL_RemoveTimer even doesn’t work in the callback.
I think if your SDL_AddTimer( ) callback returns a negative value,
the timer stops. (Hope it wasn’t just a bug in my code! )
It’s not a bug. The timer is supposed to return the next interval, or the value it was passed, if you want a periodic timer. Isn’t that in the docs?
See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software
It’s not a bug. The timer is supposed to return the next interval,
or the value it was passed, if you want a periodic timer.
Isn’t that in the docs?
It is, but the docs do not mention the fact that returning a negative
value will actually stop the timer.
M.C.
It’s not a bug. The timer is supposed to return the next interval,
or the value it was passed, if you want a periodic timer.
Isn’t that in the docs?
It is, but the docs do not mention the fact that returning a negative
value will actually stop the timer.
Why would you return a negative value as an unsigned 32-bit quantity
designating the next alarm interval?
See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software