Improvements for Angelscript ContextPool
This commit is contained in:
parent
d4a080714c
commit
6146a2b22e
|
@ -24,11 +24,13 @@ class ContextPool {
|
||||||
|
|
||||||
CtxThreadedPoolStorage* GetThreadPool() {
|
CtxThreadedPoolStorage* GetThreadPool() {
|
||||||
auto id = std::this_thread::get_id();
|
auto id = std::this_thread::get_id();
|
||||||
if (!_pool.Has(id)) {
|
auto tryGet = _pool.TryGet(id);
|
||||||
auto t = CtxThreadedPoolStorage();
|
if (tryGet.has_value()) {
|
||||||
_pool.Insert(id, new CtxThreadedPoolStorage());
|
return tryGet->get();
|
||||||
}
|
}
|
||||||
return _pool[id];
|
auto p = new CtxThreadedPoolStorage();
|
||||||
|
_pool.Insert(id, p);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue