mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #18203: Replace malloc() with PyMem_RawMalloc() to allocate thread locks
This commit is contained in:
parent
b7f1f65f1c
commit
80aa565fb4
2 changed files with 10 additions and 10 deletions
|
@ -34,7 +34,7 @@ typedef NRMUTEX *PNRMUTEX;
|
|||
PNRMUTEX
|
||||
AllocNonRecursiveMutex()
|
||||
{
|
||||
PNRMUTEX m = (PNRMUTEX)malloc(sizeof(NRMUTEX));
|
||||
PNRMUTEX m = (PNRMUTEX)PyMem_RawMalloc(sizeof(NRMUTEX));
|
||||
if (!m)
|
||||
return NULL;
|
||||
if (PyCOND_INIT(&m->cv))
|
||||
|
@ -46,7 +46,7 @@ AllocNonRecursiveMutex()
|
|||
m->locked = 0;
|
||||
return m;
|
||||
fail:
|
||||
free(m);
|
||||
PyMem_RawFree(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex)
|
|||
if (mutex) {
|
||||
PyCOND_FINI(&mutex->cv);
|
||||
PyMUTEX_FINI(&mutex->cs);
|
||||
free(mutex);
|
||||
PyMem_RawFree(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex)
|
|||
result = PyCOND_SIGNAL(&mutex->cv);
|
||||
result &= PyMUTEX_UNLOCK(&mutex->cs);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* if ! _PY_USE_CV_LOCKS */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue