Introduce mutex for MAC scheduler
Different threads (e.g., RRC, DU tasks) might access the scheduler at the same time as the thread that drivers the scheduler itself (ru_thread). To avoid data races, introduce this mutex. Most functions of the scheduler are only used internally and have been marked static in the previous commit. The remaining ones, in this commit, either lock the scheduler mutex sched_lock, or a comment has been added of the assumption of how such function is to be locked (e.g., if it might be called from different places, or if it is called by a function that already locks the scheduler).
This commit is contained in:
@@ -1010,7 +1010,10 @@ int main(int argc, char **argv)
|
||||
UE_info->UE_sched_ctrl.harq_processes[harq_pid].ndi = !(trial&1);
|
||||
UE_info->UE_sched_ctrl.harq_processes[harq_pid].round = round;
|
||||
|
||||
// nr_schedule_ue_spec() requires the mutex to be locked
|
||||
NR_SCHED_LOCK(&gNB_mac->sched_lock);
|
||||
nr_schedule_ue_spec(0, frame, slot, &Sched_INFO->DL_req, &Sched_INFO->TX_req);
|
||||
NR_SCHED_UNLOCK(&gNB_mac->sched_lock);
|
||||
Sched_INFO->module_id = 0;
|
||||
Sched_INFO->CC_id = 0;
|
||||
Sched_INFO->frame = frame;
|
||||
|
||||
Reference in New Issue
Block a user