I had been using channels exclusively. I recently shifted to interfaces. The code is now more elegant.
One issue I face is the timing related to interface calls.
Say thread 1 calls interface A_interface's functions foo and other consecutively:
A_interface.foo()
A_interface.other()
A_interface is being monitored by thread 2, in the following way:
Code: Select all
while(1){
select{
#pragma ordered
case A[int i].foo():
/* code */
break;
case A[int i].other():
/* code */
break;
}
}
In case of interfaces, how does this work? Since interface calls are nonblocking, is it possible for other() to be executed first?