Add feature: priority

Signed-off-by: Jing Wang <jingwang96@qq.com>
This commit is contained in:
Jing Wang
2026-05-12 11:51:57 +00:00
parent d627a45881
commit b6549b6e38
11 changed files with 382 additions and 66 deletions

View File

@@ -17,11 +17,21 @@ class ShmWorker {
bool try_lock_gpu(bool &out_self_hold);
bool lock_gpu(bool &out_self_hold);
void unlock_gpu();
void unlock_gpu(bool keep_wait = false);
bool has_higher_priority_waiter();
void start_wait();
void cancel_wait();
private:
int32_t tgid;
int gpu_id;
int shm_slot;
uint16_t priority;
uint32_t waiting_timestamp;
bool is_waiting;
bool is_holding_lock;
ShmHelper *shm_helper;
std::thread heart_beat_thread;
std::atomic<bool> stop_heart_beat;
@@ -31,5 +41,5 @@ class ShmWorker {
int register_worker_shm();
// heart beat
void heart_beat_loop(int slot);
};
void heart_beat_loop();
};