Commit 8a7f817d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent d8d963a9
...@@ -611,7 +611,6 @@ const char * __thiscall MSVCRT_type_info_name(type_info * _this) ...@@ -611,7 +611,6 @@ const char * __thiscall MSVCRT_type_info_name(type_info * _this)
*/ */
char* name = __unDName(0, _this->mangled + 1, 0, char* name = __unDName(0, _this->mangled + 1, 0,
MSVCRT_malloc, MSVCRT_free, 0x2800); MSVCRT_malloc, MSVCRT_free, 0x2800);
if (name) if (name)
{ {
unsigned int len = strlen(name); unsigned int len = strlen(name);
...@@ -620,17 +619,11 @@ const char * __thiscall MSVCRT_type_info_name(type_info * _this) ...@@ -620,17 +619,11 @@ const char * __thiscall MSVCRT_type_info_name(type_info * _this)
while (len && name[--len] == ' ') while (len && name[--len] == ' ')
name[len] = '\0'; name[len] = '\0';
_mlock(_EXIT_LOCK2); if (InterlockedCompareExchangePointer((void**)&_this->name, name, NULL))
if (_this->name)
{ {
/* Another thread set this member since we checked above - use it */ /* Another thread set this member since we checked above - use it */
MSVCRT_free(name); MSVCRT_free(name);
} }
else
_this->name = name;
_munlock(_EXIT_LOCK2);
} }
} }
TRACE("(%p) returning %s\n", _this, _this->name); TRACE("(%p) returning %s\n", _this, _this->name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment