diff options
| author | 2020-07-27 19:00:41 -0400 | |
|---|---|---|
| committer | 2020-07-27 21:21:01 -0400 | |
| commit | a7af349daee85237384dba07533c9a407cf15592 (patch) | |
| tree | e337a6e823960cc6b2a7d05c7e33e80cc51a4581 /src/core/core_timing.h | |
| parent | Merge pull request #4419 from lioncash/initializer (diff) | |
| download | yuzu-a7af349daee85237384dba07533c9a407cf15592.tar.gz yuzu-a7af349daee85237384dba07533c9a407cf15592.tar.xz yuzu-a7af349daee85237384dba07533c9a407cf15592.zip | |
core_timing: Make use of uintptr_t to represent user_data
Makes the interface future-proofed for supporting other platforms in the event we ever support platforms with differing pointer sizes. This way, we have a type in place that is always guaranteed to be able to represent a pointer exactly.
Diffstat (limited to 'src/core/core_timing.h')
| -rw-r--r-- | src/core/core_timing.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index 120c74e46..b0b6036e4 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h | |||
| @@ -22,7 +22,8 @@ | |||
| 22 | namespace Core::Timing { | 22 | namespace Core::Timing { |
| 23 | 23 | ||
| 24 | /// A callback that may be scheduled for a particular core timing event. | 24 | /// A callback that may be scheduled for a particular core timing event. |
| 25 | using TimedCallback = std::function<void(u64 userdata, std::chrono::nanoseconds ns_late)>; | 25 | using TimedCallback = |
| 26 | std::function<void(std::uintptr_t user_data, std::chrono::nanoseconds ns_late)>; | ||
| 26 | 27 | ||
| 27 | /// Contains the characteristics of a particular event. | 28 | /// Contains the characteristics of a particular event. |
| 28 | struct EventType { | 29 | struct EventType { |
| @@ -94,9 +95,9 @@ public: | |||
| 94 | 95 | ||
| 95 | /// Schedules an event in core timing | 96 | /// Schedules an event in core timing |
| 96 | void ScheduleEvent(std::chrono::nanoseconds ns_into_future, | 97 | void ScheduleEvent(std::chrono::nanoseconds ns_into_future, |
| 97 | const std::shared_ptr<EventType>& event_type, u64 userdata = 0); | 98 | const std::shared_ptr<EventType>& event_type, std::uintptr_t user_data = 0); |
| 98 | 99 | ||
| 99 | void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, u64 userdata); | 100 | void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, std::uintptr_t user_data); |
| 100 | 101 | ||
| 101 | /// We only permit one event of each type in the queue at a time. | 102 | /// We only permit one event of each type in the queue at a time. |
| 102 | void RemoveEvent(const std::shared_ptr<EventType>& event_type); | 103 | void RemoveEvent(const std::shared_ptr<EventType>& event_type); |