Nikolay Sivov : msvcrt: Use pointer exchange to set demangled name instead of section lock.

Alexandre Julliard julliard at winehq.org
Thu Feb 3 12:00:23 CST 2011


Module: wine
Branch: master
Commit: 8a7f817dea66ccb10d22380117c20b9bf224ba42
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8a7f817dea66ccb10d22380117c20b9bf224ba42

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Feb  3 15:42:46 2011 +0300

msvcrt: Use pointer exchange to set demangled name instead of section lock.

---

 dlls/msvcrt/cpp.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index 4d0f5d5..1e7a20a 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -611,7 +611,6 @@ const char * __thiscall MSVCRT_type_info_name(type_info * _this)
      */
     char* name = __unDName(0, _this->mangled + 1, 0,
                            MSVCRT_malloc, MSVCRT_free, 0x2800);
-
     if (name)
     {
       unsigned int len = strlen(name);
@@ -620,17 +619,11 @@ const char * __thiscall MSVCRT_type_info_name(type_info * _this)
       while (len && name[--len] == ' ')
         name[len] = '\0';
 
-      _mlock(_EXIT_LOCK2);
-
-      if (_this->name)
+      if (InterlockedCompareExchangePointer((void**)&_this->name, name, NULL))
       {
         /* Another thread set this member since we checked above - use it */
         MSVCRT_free(name);
       }
-      else
-        _this->name = name;
-
-      _munlock(_EXIT_LOCK2);
     }
   }
   TRACE("(%p) returning %s\n", _this, _this->name);




More information about the wine-cvs mailing list