@@ -27,28 +27,28 @@ class SyncpointManager {
2727 }
2828
2929 struct RegisteredAction {
30- explicit RegisteredAction (u32 expected_value_, std::function<void ()>&& action_)
31- : expected_value{expected_value_}, action{std::move (action_)} {}
30+ explicit RegisteredAction (u32 expected_value_, u32 action_id_, std::function<void ()>&& action_)
31+ : expected_value{expected_value_}, action_id{ action_id_}, action{std::move (action_)} {}
32+ u32 action_id;
3233 u32 expected_value;
3334 std::function<void ()> action;
3435 };
35- using ActionHandle = std::list<RegisteredAction>::iterator;
3636
3737 template <typename Func>
38- ActionHandle RegisterGuestAction (u32 syncpoint_id, u32 expected_value, Func&& action) {
38+ uint32_t RegisterGuestAction (u32 syncpoint_id, u32 expected_value, Func&& action) {
3939 return RegisterAction (syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id],
4040 expected_value, std::move (action));
4141 }
4242
4343 template <typename Func>
44- ActionHandle RegisterHostAction (u32 syncpoint_id, u32 expected_value, Func&& action) {
44+ uint32_t RegisterHostAction (u32 syncpoint_id, u32 expected_value, Func&& action) {
4545 return RegisterAction (syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id],
4646 expected_value, std::move (action));
4747 }
4848
49- void DeregisterGuestAction (u32 syncpoint_id, const ActionHandle& handle);
49+ void DeregisterGuestAction (u32 syncpoint_id, uint32_t handle);
5050
51- void DeregisterHostAction (u32 syncpoint_id, const ActionHandle& handle);
51+ void DeregisterHostAction (u32 syncpoint_id, uint32_t handle);
5252
5353 void IncrementGuest (u32 syncpoint_id);
5454
@@ -70,11 +70,11 @@ class SyncpointManager {
7070 void Increment (std::atomic<u32 >& syncpoint, std::condition_variable& wait_cv,
7171 std::list<RegisteredAction>& action_storage);
7272
73- ActionHandle RegisterAction (std::atomic<u32 >& syncpoint,
73+ uint32_t RegisterAction (std::atomic<u32 >& syncpoint,
7474 std::list<RegisteredAction>& action_storage, u32 expected_value,
7575 std::function<void ()>&& action);
7676
77- void DeregisterAction (std::list<RegisteredAction>& action_storage, const ActionHandle& handle);
77+ void DeregisterAction (std::list<RegisteredAction>& action_storage, uint32_t handle);
7878
7979 void Wait (std::atomic<u32 >& syncpoint, std::condition_variable& wait_cv, u32 expected_value);
8080
@@ -83,6 +83,7 @@ class SyncpointManager {
8383 std::array<std::atomic<u32 >, NUM_MAX_SYNCPOINTS > syncpoints_guest{};
8484 std::array<std::atomic<u32 >, NUM_MAX_SYNCPOINTS > syncpoints_host{};
8585
86+ std::atomic<uint32_t > next_action_id{ 1 };
8687 std::array<std::list<RegisteredAction>, NUM_MAX_SYNCPOINTS > guest_action_storage;
8788 std::array<std::list<RegisteredAction>, NUM_MAX_SYNCPOINTS > host_action_storage;
8889
0 commit comments