This commit is contained in:
blueloveTH 2023-07-14 22:47:22 +08:00
parent f7c12ec213
commit 8f5f3f43c2
2 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@
/*******************************************************************************/ /*******************************************************************************/
#if PK_ENABLE_THREAD #if PK_ENABLE_THREAD
#define THREAD_LOCAL thread_local #define PK_THREAD_LOCAL thread_local
#include <mutex> #include <mutex>
struct GIL { struct GIL {
@ -48,10 +48,10 @@ struct GIL {
explicit GIL() { _mutex.lock(); } explicit GIL() { _mutex.lock(); }
~GIL() { _mutex.unlock(); } ~GIL() { _mutex.unlock(); }
}; };
#define PK_GLOBAL_SCOPE_LOCK() auto _lock = GIL(); #define PK_GLOBAL_SCOPE_LOCK() GIL _lock();
#else #else
#define THREAD_LOCAL #define PK_THREAD_LOCAL
#define PK_GLOBAL_SCOPE_LOCK() #define PK_GLOBAL_SCOPE_LOCK()
#endif #endif

View File

@ -742,7 +742,7 @@ PyObject* VM::vectorcall(int ARGC, int KWARGC, bool op_call){
ArgsView args(p1 - ARGC - int(method_call), p1); ArgsView args(p1 - ARGC - int(method_call), p1);
ArgsView kwargs(p1, s_data._sp); ArgsView kwargs(p1, s_data._sp);
static THREAD_LOCAL PyObject* buffer[PK_MAX_CO_VARNAMES]; static PK_THREAD_LOCAL PyObject* buffer[PK_MAX_CO_VARNAMES];
if(is_non_tagged_type(callable, tp_native_func)){ if(is_non_tagged_type(callable, tp_native_func)){
const auto& f = PK_OBJ_GET(NativeFunc, callable); const auto& f = PK_OBJ_GET(NativeFunc, callable);