Return in alternative
Is it allowed to return in an alternative? e.g.
function f_func() runs on X return verdicttype {
alt {
[] pt_Port.receive(m_msgTmpl) {
log("Got a message");
return pass;
}
[] t_tmr.timeout {
return fail;
}
}
return fail;
}
...
var verdicttype v_verdict := none;
v_verdict := f_func();
if (v_verdict == pass) {
setverdict(pass, "Yay");
}
else {
setverdict(fail, "Boo");
}
Output in log:
- "Got a message"
- verdict = fail "Boo"
My logs show the port receiving a valid message which should cause f_func to return pass, but the returned value from the function is not pass, as the log then shows the verdict set to fail.
Also, is the 'return fail' at the end of the function ever reached?
I looked at the generated c++ code and cant see why it doesn't work. Looks fine. return is generated as expected. What I am missing???
Edited by Ashley Duncan