[runtime] Put back ensure_synch_cs_set () which was removed in a157ac79e8f404f0eb9b263f5de697f13528deec to work around some shutdown crashes.