| Summary: | Timer Underflow | ||
|---|---|---|---|
| Product: | SDL | Reporter: | dino puller <dino.puller> |
| Component: | timer | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 1.2 | ||
| Hardware: | All | ||
| OS: | All | ||
(In reply to comment #0) > If you try to set a delay < 10ms a variable may got to underflow into > void SDL_ThreadedTimerCheck(void) > > I suggest to change: > ms = t->interval - SDL_TIMESLICE; > next = t->next; > if ( (int)(now - t->last_alarm) > (int)ms ) { > > with: > if ( (int)(now - t->last_alarm + SDL_TIMESLICE) > (int)ms ) { > > > bye, > Dino The suggested line was: if ( (int)(now - t->last_alarm + SDL_TIMESLICE) > t->interval ) { Anyway t->interval is always rounded to be at least SDL_TIMESLICE, so no underflow will happen. |
If you try to set a delay < 10ms a variable may got to underflow into void SDL_ThreadedTimerCheck(void) I suggest to change: ms = t->interval - SDL_TIMESLICE; next = t->next; if ( (int)(now - t->last_alarm) > (int)ms ) { with: if ( (int)(now - t->last_alarm + SDL_TIMESLICE) > (int)ms ) { bye, Dino