global glob int x = 0 sem mutex = 1 # for exclusive access to x body glob final { write(x) } end