This commit is contained in:
blueloveTH 2022-12-14 05:53:44 +08:00
parent 40283067a3
commit ae3248d865
6 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
## 0.5.0+5 ## 0.5.0+6
+ Fix a bug of crash when using multi-thread + Fix a bug of crash when using multi-thread

View File

@ -1,6 +1,6 @@
name: pocketpy name: pocketpy
description: A lightweight Python interpreter for game engines. description: A lightweight Python interpreter for game engines.
version: 0.5.0+5 version: 0.5.0+6
homepage: https://pocketpy.dev homepage: https://pocketpy.dev
repository: https://github.com/blueloveth/pocketpy repository: https://github.com/blueloveth/pocketpy

View File

@ -2307,7 +2307,7 @@ public:
namespace pkpy { namespace pkpy {
const uint8_t MAX_POOLING_N = 10; const uint8_t MAX_POOLING_N = 10;
static std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N]; static thread_local std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N];
class ArgList { class ArgList {
PyVar* _args = nullptr; PyVar* _args = nullptr;
@ -2428,7 +2428,7 @@ namespace pkpy {
}; };
const ArgList& noArg(){ const ArgList& noArg(){
static ArgList ret(0); static const ArgList ret(0);
return ret; return ret;
} }
@ -3865,7 +3865,7 @@ public:
Frame(const CodeObject* code, PyVar _module, PyVarDict&& locals) Frame(const CodeObject* code, PyVar _module, PyVarDict&& locals)
: code(code), _module(_module), f_locals(std::move(locals)) { : code(code), _module(_module), f_locals(std::move(locals)) {
static uint64_t frame_id = 1; static thread_local uint64_t frame_id = 1;
id = frame_id++; id = frame_id++;
} }

@ -1 +1 @@
Subproject commit 5e4cc4c44a5b65a9ea53e038ffb7c83591d27698 Subproject commit 489e88e885effa484134f98db933ca45659c2026

View File

@ -143,7 +143,7 @@ public:
Frame(const CodeObject* code, PyVar _module, PyVarDict&& locals) Frame(const CodeObject* code, PyVar _module, PyVarDict&& locals)
: code(code), _module(_module), f_locals(std::move(locals)) { : code(code), _module(_module), f_locals(std::move(locals)) {
static uint64_t frame_id = 1; static thread_local uint64_t frame_id = 1;
id = frame_id++; id = frame_id++;
} }

View File

@ -64,7 +64,7 @@ public:
namespace pkpy { namespace pkpy {
const uint8_t MAX_POOLING_N = 10; const uint8_t MAX_POOLING_N = 10;
static std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N]; static thread_local std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N];
class ArgList { class ArgList {
PyVar* _args = nullptr; PyVar* _args = nullptr;
@ -185,7 +185,7 @@ namespace pkpy {
}; };
const ArgList& noArg(){ const ArgList& noArg(){
static ArgList ret(0); static const ArgList ret(0);
return ret; return ret;
} }