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