ER_UINT acre_flg(const T_CFLG *pk_cflg) { FLGCB *p_flgcb; FLGINIB *p_flginib; ER ercd; LOG_ACRE_FLG_ENTER(pk_cflg); CHECK_TSKCTX_UNL(); CHECK_RSATR(pk_cflg->flgatr, TA_TPRI|TA_WMUL|TA_CLR); t_lock_cpu(); if (tnum_flg == 0 || queue_empty(&free_flgcb)) { ercd = E_NOID; } else { p_flgcb = ((FLGCB *) queue_delete_next(&free_flgcb)); p_flginib = (FLGINIB *)(p_flgcb->p_flginib); p_flginib->flgatr = pk_cflg->flgatr; p_flginib->iflgptn = pk_cflg->iflgptn; queue_initialize(&(p_flgcb->wait_queue)); p_flgcb->flgptn = p_flgcb->p_flginib->iflgptn; ercd = FLGID(p_flgcb); } t_unlock_cpu(); error_exit: LOG_ACRE_FLG_LEAVE(ercd); return(ercd); }
ER_UINT acre_flg(const T_CFLG *pk_cflg) { ID domid; FLGCB *p_flgcb; FLGINIB *p_flginib; ACPTN acptn; ER ercd; LOG_ACRE_FLG_ENTER(pk_cflg); CHECK_TSKCTX_UNL(); CHECK_MACV_READ(pk_cflg, T_CFLG); CHECK_RSATR(pk_cflg->flgatr, TA_TPRI|TA_WMUL|TA_CLR|TA_DOMMASK); domid = get_atrdomid(pk_cflg->flgatr); CHECK_ATRDOMID_INACTIVE(domid); CHECK_ACPTN(sysstat_acvct.acptn3); t_lock_cpu(); if (tnum_flg == 0 || queue_empty(&free_flgcb)) { ercd = E_NOID; } else { p_flgcb = ((FLGCB *) queue_delete_next(&free_flgcb)); p_flginib = (FLGINIB *)(p_flgcb->p_flginib); p_flginib->flgatr = pk_cflg->flgatr; p_flginib->iflgptn = pk_cflg->iflgptn; acptn = default_acptn(domid); p_flginib->acvct.acptn1 = acptn; p_flginib->acvct.acptn2 = acptn; p_flginib->acvct.acptn3 = acptn | rundom; p_flginib->acvct.acptn4 = acptn; queue_initialize(&(p_flgcb->wait_queue)); p_flgcb->flgptn = p_flgcb->p_flginib->iflgptn; ercd = FLGID(p_flgcb); } t_unlock_cpu(); error_exit: LOG_ACRE_FLG_LEAVE(ercd); return(ercd); }