Allocate a mutex object instead of embedding it in a structure

It makes macros simple for MPSAFE and non-MPSAFE cases and
allocates a mutex object aligned to cache lines.