/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Lib/python/director_py_mutex.swg
24 строки
739 B
Vadim Zeitlin
Fix crash when using directors in Python without limited API
28 янв 2025, 17:11
28 янв 2025, 17:11
892be2b
Код
Авторство
О чём код?
/* ----------------------------------------------------------------------------- * director_py_mutex.swg * * contains python mutex for threads * ----------------------------------------------------------------------------- */ #if defined(SWIG_PYTHON_THREADS) && !defined(SWIG_THREADS) #define SWIG_THREADS 1 #endif #if defined(SWIG_THREADS) && !defined(Py_LIMITED_API) #include "pythread.h" #define SWIG_HAVE_MUTEX namespace Swig { class Mutex { PyThread_type_lock mutex_; public: Mutex() : mutex_(PyThread_allocate_lock()) {} ~Mutex() { PyThread_free_lock(mutex_); } void lock() { PyThread_acquire_lock(mutex_, WAIT_LOCK); } void unlock() { PyThread_release_lock(mutex_); } }; } #endif