I\'m writing a function that needs to use mutable static variables to work (a weird implementation of a message loop). In order to allow only one writer to access those vari