>```<br>>if (running_on_hart(active)) { ... }<br>>```<br>>Yes, these codes are clearer.<br>><br>>/*<br>> * If your code needs to temporarily block multiple-threads, do this:<br>> *     SMP_PAUSE(active)    // `active` is hartid of working thread<br>> *     ... single-threaded work ...<br>> *     SMP_RESUME()<br>> *     ... multi-threaded work ...<br>> */<br>>But sometimes multi-threaded work has to wait for the single-threaded work to complete.<br>><br>>etc:<br>>    single-threaded work : init ddr controller<br>>    multi-threaded work  : some operations related to memory<br>><br>>It is necessary to wait for the completion of single-threaded work.<br>><br>>Xiang Wang<br><br>There is other solution here.<br>```<br>#define HART_NUM 5<br><br>void smp_sync(unsigned long *cnt) <br>{<br>    atomic_add(cnt,1);<br>    do {<br>        barrier();<br>    }while(*cnt < HART_MAX);<br>}<br><br>static unsigned long cnt;<br>if (running_on_hart(active)) { ... }<br>smp_sync(&cnt);<br>```<br>This solution must define HART_NUM.<br>I think this solution is not as flexible as SMP_PAUSE/SMP_RESUME.<br>Which solution do you want to use?<br><br>Xiang Wang<includetail><!--<![endif]--></includetail>