Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions pyeda/boolalg/picosatmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,32 @@ static PyObject *Error;
inline static void *
_pymalloc(void *pmgr, size_t nbytes)
{
return PyMem_Malloc(nbytes);
void *ptr;
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
ptr = PyMem_Malloc(nbytes);
PyGILState_Release(gstate);
return ptr;
}

inline static void *
_pyrealloc(void *pmgr, void *p, size_t old, size_t new)
{
return PyMem_Realloc(p, new);
void *ptr;
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
ptr = PyMem_Realloc(p, new);
PyGILState_Release(gstate);
return ptr;
}

inline static void
_pyfree(void *pmgr, void *p, size_t nbytes)
{
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
PyMem_Free(p);
PyGILState_Release(gstate);
}


Expand Down