I'm trying to simulate the behaviour of other model-checkers using Spin. For that, I need to be able to test for some arbitrary condition in the message queue. For instance, I want to check if somewhere in the channel there exists some message with an int greater than 5. Not only that, I need such condition to be inside an atomic block.
I tried doing something like this:
int mid;
do
:: atomic {
in??[msg(mid)] && mid > 5 -> (...)
}
But Spin reads that condition as
in??[msg(mid)] && 0 > 5
I've tried something of this sort:
do
:: atomic {
in??<msg(mid)>;
if
:: mid > 5 ->
in??msg(eval(mid));
(...)
:: else -> skip
fi }
Which works, but is semantically different from what I want because it gets into the atomic block only for it to fail that condition and skip it.
So, is there some way of checking for an arbitrary condition in a message queue and to only execute an atomic block if such condition is valid?