add synchronization barrier after writing BASEPRI and PSP