ER trcv_mbx(ID mbxid, T_MSG **ppk_msg, TMO tmout) { MBXCB *p_mbxcb; WINFO_MBX winfo_mbx; TMEVTB tmevtb; ER ercd; LOG_TRCV_MBX_ENTER(mbxid, ppk_msg, tmout); CHECK_DISPATCH(); CHECK_MBXID(mbxid); CHECK_TMOUT(tmout); p_mbxcb = get_mbxcb(mbxid); t_lock_cpu(); if (p_mbxcb->pk_head != NULL) { *ppk_msg = p_mbxcb->pk_head; p_mbxcb->pk_head = (*ppk_msg)->pk_next; ercd = E_OK; } else if (tmout == TMO_POL) { ercd = E_TMOUT; } else { p_runtsk->tstat = (TS_WAITING | TS_WAIT_MBX); wobj_make_wait_tmout((WOBJCB *) p_mbxcb, (WINFO_WOBJ *) &winfo_mbx, &tmevtb, tmout); dispatch(); ercd = winfo_mbx.winfo.wercd; if (ercd == E_OK) { *ppk_msg = winfo_mbx.pk_msg; } } t_unlock_cpu(); error_exit: LOG_TRCV_MBX_LEAVE(ercd, *ppk_msg); return(ercd); }
SYSCALL ER trcv_mbx(ID mbxid, T_MSG **ppk_msg, TMO tmout) { MBXCB *mbxcb; WINFO_MBX winfo; TMEVTB tmevtb; ER ercd; LOG_TRCV_MBX_ENTER(mbxid, ppk_msg, tmout); CHECK_DISPATCH(); CHECK_MBXID(mbxid); CHECK_TMOUT(tmout); mbxcb = get_mbxcb(mbxid); t_lock_cpu(); if (mbxcb->head != NULL) { *ppk_msg = mbxcb->head; mbxcb->head = (*ppk_msg)->next; ercd = E_OK; } else if (tmout == TMO_POL) { ercd = E_TMOUT; } else { wobj_make_wait_tmout((WOBJCB *) mbxcb, (WINFO_WOBJ *) &winfo, &tmevtb, tmout); dispatch(); ercd = winfo.winfo.wercd; if (ercd == E_OK) { *ppk_msg = winfo.pk_msg; } } t_unlock_cpu(); exit: LOG_TRCV_MBX_LEAVE(ercd, *ppk_msg); return(ercd); }