[PATCH 1/2] Use pointer exchange to set demangled name instead of section lock
Nikolay Sivov
nsivov at codeweavers.com
Thu Feb 3 06:42:46 CST 2011
---
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);
--
1.5.6.5
--------------030508060907020901050109--
More information about the wine-patches
mailing list