Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1.2 and tip

stable shellext: simplify code by using atomic operations instead of critical sections

Changeset c2050ce0c6de

Parent 38f47b6798cb

by David Golub

Changes to 4 files · Browse files at c2050ce0c6de Showing diff from parent 38f47b6798cb Diff from another changeset...

 
986
987
988
989
990
 
991
992
993
994
995
996
997
 
998
999
1000
 
986
987
988
 
 
989
990
991
992
993
994
 
 
995
996
997
998
@@ -986,15 +986,13 @@
   STDMETHODIMP_(ULONG) CShellExtCMenu::AddRef()  { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - return ++m_cRef; + return ::InterlockedIncrement(&m_cRef);  }      STDMETHODIMP_(ULONG) CShellExtCMenu::Release()  { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - if(--m_cRef) + if(::InterlockedDecrement(&m_cRef))   return m_cRef;   delete this;   return 0L;
 
90
91
92
93
94
 
95
96
97
98
99
100
101
 
102
103
104
 
90
91
92
 
 
93
94
95
96
97
98
 
 
99
100
101
102
@@ -90,15 +90,13 @@
   STDMETHODIMP_(ULONG) CShellExtOverlay::AddRef()  { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - return ++m_cRef; + return ::InterlockedIncrement(&m_cRef);  }      STDMETHODIMP_(ULONG) CShellExtOverlay::Release()  { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - if(--m_cRef) + if(::InterlockedDecrement(&m_cRef))   return m_cRef;   delete this;   return 0L;
 
155
156
157
158
159
 
160
161
162
163
164
165
166
 
167
 
155
156
157
 
 
158
159
160
161
162
163
 
 
164
165
@@ -155,13 +155,11 @@
   void CShellExt::IncDllRef()  { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - g_cRefThisDll++; + ::InterlockedIncrement(&g_cRefThisDll);  }      void CShellExt::DecDllRef()  { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - g_cRefThisDll--; + ::InterlockedDecrement(&g_cRefThisDll);  }
 
46
47
48
49
50
 
51
52
53
54
55
56
57
 
58
59
60
 
46
47
48
 
 
49
50
51
52
53
54
 
 
55
56
57
58
@@ -46,15 +46,13 @@
    STDMETHODIMP_(ULONG) AddRef()   { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - return ++m_cRef; + return ::InterlockedIncrement(&m_cRef);   }       STDMETHODIMP_(ULONG) Release()   { - ThgCriticalSection cs(CShellExt::GetCriticalSection()); - if (--m_cRef) + if (::InterlockedDecrement(&m_cRef))   return m_cRef;     delete this;