Is there a difference between the following pieces of code:
while (a==b);
while (a==b) {;}
Does it make an impact on compiler or execution time?
Background for this questions: Currently the FW uses code 1, where a or b is actually a global variable and the FW hangs/waits in a particular core till the condition is made true by another core. We would like to simulate this code in SystemC and this "infinite" while loop is not under SystemC context and therefore the SystemC scheduler will not know that this thread is waiting for another, leading to a deadlock.
Therefore we want to replace the code with: while (a==b) {CONTEXT_SWITCH(1);}
where for target build we have:
#define CONTEXT_SWITCH(x)
and for systemC build we have:
#define CONTEXT_SWITCH(x) wait(x) //where wait is a systemC wait
This code in the case of target build becomes code 2. Wanted to know if this can impact performance somehow?