Outils pour utilisateurs

Outils du site


helloworld:design_pattern:singleton:cplusplus

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
helloworld:design_pattern:singleton:cplusplus [2020/04/28 08:43] – mhtml -> html roothelloworld:design_pattern:singleton:cplusplus [2022/07/04 10:06] (Version actuelle) – [Solution] : lock_guard->scoped_lock root
Ligne 31: Ligne 31:
  
   if (tmp == nullptr) {   if (tmp == nullptr) {
-    std::lock_guard<std::mutex> lock(m_mutex);+    std::scoped_lock<std::mutex> lock(m_mutex);
     tmp = m_instance.load(std::memory_order_relaxed);     tmp = m_instance.load(std::memory_order_relaxed);
     if (tmp == nullptr) {     if (tmp == nullptr) {
helloworld/design_pattern/singleton/cplusplus.1588056206.txt.gz · Dernière modification : de root