Since C++11 static variables are initialized thread-safe. That's usually done with double-checked locking (DCL). DCL needs a mutex to synchronize the initialization if the initialization hasn't been done yet. Even if DCL wouldn't be used you'd need a mutex to synchronize the intialization. So does the standard say somewhere that static variables may throw a system_error on their first usage before the constructor is actually called ?
Aucun commentaire:
Enregistrer un commentaire