Locks the global state of the signals since they are global. Thanks to Jan Mercl.