Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
0bb940db
Commit
0bb940db
authored
Oct 13, 2025
by
PanZezhong1725
Browse files
issue/461 make current runtime thread local
parent
acb75f3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
src/infinicore/context/context_impl.cc
src/infinicore/context/context_impl.cc
+2
-0
src/infinicore/context/context_impl.hpp
src/infinicore/context/context_impl.hpp
+3
-1
No files found.
src/infinicore/context/context_impl.cc
View file @
0bb940db
...
...
@@ -4,6 +4,8 @@
namespace
infinicore
{
thread_local
Runtime
*
ContextImpl
::
current_runtime_
=
nullptr
;
Runtime
*
ContextImpl
::
getCurrentRuntime
()
{
return
current_runtime_
;
}
...
...
src/infinicore/context/context_impl.hpp
View file @
0bb940db
...
...
@@ -8,8 +8,10 @@
namespace
infinicore
{
class
ContextImpl
{
private:
// Table of runtimes for every device (type and index)
std
::
array
<
std
::
vector
<
std
::
unique_ptr
<
Runtime
>>
,
size_t
(
Device
::
Type
::
COUNT
)
>
runtime_table_
;
Runtime
*
current_runtime_
=
nullptr
;
// Active runtime for current thread. Can use "static thread local" because context is a process singleton.
static
thread_local
Runtime
*
current_runtime_
;
protected:
ContextImpl
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment