From 8a7f817dea66ccb10d22380117c20b9bf224ba42 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 3 Feb 2011 15:42:46 +0300 Subject: [PATCH] msvcrt: Use pointer exchange to set demangled name instead of section lock. --- dlls/msvcrt/cpp.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c index 4d0f5d51d68..1e7a20a9472 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);