bool_t receive_pridata(PDQCB *p_pdqcb, intptr_t *p_data, PRI *p_datapri, bool_t *p_reqdsp) { TCB *p_tcb; intptr_t data; PRI datapri; if (p_pdqcb->count > 0U) { dequeue_pridata(p_pdqcb, p_data, p_datapri); if (!queue_empty(&(p_pdqcb->swait_queue))) { p_tcb = (TCB *) queue_delete_next(&(p_pdqcb->swait_queue)); data = ((WINFO_PDQ *)(p_tcb->p_winfo))->data; datapri = ((WINFO_PDQ *)(p_tcb->p_winfo))->datapri; enqueue_pridata(p_pdqcb, data, datapri); *p_reqdsp = wait_complete(p_tcb); } else { *p_reqdsp = false; } return(true); } else if (!queue_empty(&(p_pdqcb->swait_queue))) { p_tcb = (TCB *) queue_delete_next(&(p_pdqcb->swait_queue)); *p_data = ((WINFO_PDQ *)(p_tcb->p_winfo))->data; *p_datapri = ((WINFO_PDQ *)(p_tcb->p_winfo))->datapri; *p_reqdsp = wait_complete(p_tcb); return(true); } else { return(false); } }
bool_t send_pridata(PDQCB *p_pdqcb, intptr_t data, PRI datapri) { TCB *p_tcb; if (!queue_empty(&(p_pdqcb->rwait_queue))) { p_tcb = (TCB *) queue_delete_next(&(p_pdqcb->rwait_queue)); ((WINFO_RPDQ *)(p_tcb->p_winfo))->data = data; ((WINFO_RPDQ *)(p_tcb->p_winfo))->datapri = datapri; wait_complete(p_tcb); return(true); } else if (p_pdqcb->count < p_pdqcb->p_pdqinib->pdqcnt) { enqueue_pridata(p_pdqcb, data, datapri); return(true); } else { return(false); } }