sync Simple sync primitives I use here and there, extracted so I can reuse them. TODO: move more code from other places into this lib.