ScummVM API documentation
libretro-timer.h
1 /* Copyright (C) 2023 Giovanni Cascione <ing.cascione@gmail.com>
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17 
18 #ifndef LIBRETRO_TIMER_H
19 #define LIBRETRO_TIMER_H
20 
21 // Thread switch caller
22 #define THREAD_SWITCH_POLL (1 << 0)
23 #define THREAD_SWITCH_DELAY (1 << 1)
24 #define THREAD_SWITCH_UPDATE (1 << 2)
25 
26 #include "backends/timer/default/default-timer.h"
27 #include "backends/platform/libretro/include/libretro-defs.h"
28 
30  uint32 _interval;
31  uint32 _nextSwitchTime;
32  uint32 _spentOnMainThread;
33  uint8 _threadSwitchCaller;
34 public:
35  LibretroTimerManager(uint32 refresh_rate);
36  ~LibretroTimerManager(void) {};
37  void switchThread(uint8 caller = 0);
38  bool checkThread(uint8 caller = 0);
39  uint32 timeToNextSwitch(void);
40  uint32 spentOnMainThread(void);
41  uint8 getThreadSwitchCaller(void);
42 };
43 
44 #endif // LIBRETRO_TIMER_H
Definition: default-timer.h:32
Definition: libretro-timer.h:29