src/timer/dummy/SDL_systimer.c
author Sam Lantinga
Thu, 27 Jan 2011 14:45:06 -0800
changeset 5111 481dabb098ef
parent 3697 f7b03b6838cb
child 5262 b530ef003506
permissions -rw-r--r--
Improved timer implementation

The new timer model is formalized as using a separate thread to handle timer callbacks. This was the case on almost every platform before, but it's now a requirement, and simplifies the implementation and makes it perform consistently across platforms.

Goals:
* Minimize timer thread blocking
* Dispatch timers as accurately as possible
* SDL_AddTimer() and SDL_RemoveTimer() are completely threadsafe
* SDL_RemoveTimer() doesn't crash with a timer that's expired or removed
slouken@1361
     1
/*
slouken@1361
     2
    SDL - Simple DirectMedia Layer
slouken@3697
     3
    Copyright (C) 1997-2010 Sam Lantinga
slouken@1361
     4
slouken@1361
     5
    This library is free software; you can redistribute it and/or
slouken@1361
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1361
     7
    License as published by the Free Software Foundation; either
slouken@1361
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1361
     9
slouken@1361
    10
    This library is distributed in the hope that it will be useful,
slouken@1361
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1361
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1361
    13
    Lesser General Public License for more details.
slouken@1361
    14
slouken@1361
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1361
    16
    License along with this library; if not, write to the Free Software
slouken@1361
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1361
    18
slouken@1361
    19
    Sam Lantinga
slouken@1361
    20
    slouken@libsdl.org
slouken@1361
    21
*/
slouken@1402
    22
#include "SDL_config.h"
slouken@1361
    23
slouken@1635
    24
#if defined(SDL_TIMER_DUMMY) || defined(SDL_TIMERS_DISABLED)
slouken@1635
    25
slouken@1484
    26
#include "SDL_timer.h"
slouken@1484
    27
slouken@1895
    28
void
slouken@1895
    29
SDL_StartTicks(void)
slouken@1361
    30
{
slouken@1361
    31
}
slouken@1361
    32
slouken@1895
    33
Uint32
slouken@1895
    34
SDL_GetTicks(void)
slouken@1361
    35
{
slouken@1895
    36
    SDL_Unsupported();
slouken@1895
    37
    return 0;
slouken@1361
    38
}
slouken@1361
    39
slouken@1895
    40
void
slouken@1895
    41
SDL_Delay(Uint32 ms)
slouken@1361
    42
{
slouken@1895
    43
    SDL_Unsupported();
slouken@1361
    44
}
slouken@1361
    45
slouken@5111
    46
#endif /* SDL_TIMER_DUMMY || SDL_TIMERS_DISABLED */
slouken@1361
    47
slouken@1895
    48
/* vi: set ts=4 sw=4 expandtab: */