Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
cython-plus
typon
Commits
b3fb4d4f
Commit
b3fb4d4f
authored
Jun 19, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give every worker a reference to the scheduler's gc
parent
eaca4d16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
rt/include/typon/core/scheduler.hpp
rt/include/typon/core/scheduler.hpp
+6
-5
rt/include/typon/core/worker.hpp
rt/include/typon/core/worker.hpp
+4
-4
No files found.
rt/include/typon/core/scheduler.hpp
View file @
b3fb4d4f
...
...
@@ -98,6 +98,11 @@ namespace typon
,
_concurrency
(
concurrency
)
,
_gc
(
concurrency
)
{
for
(
uint
i
=
0
;
i
<
concurrency
;
i
++
)
{
_worker
[
i
].
_gc
=
&
_gc
;
}
thread_id
=
concurrency
;
for
(
uint
id
=
0
;
id
<
concurrency
;
id
++
)
...
...
@@ -137,11 +142,7 @@ namespace typon
_notifyer
.
notify_one
();
}
}
auto
garbage
=
_worker
[
thread_id
].
resume
(
work
);
if
(
garbage
)
{
_gc
.
retire
(
garbage
);
}
_worker
[
thread_id
].
resume
(
work
);
_actives
.
fetch_sub
(
1
);
}
...
...
rt/include/typon/core/worker.hpp
View file @
b3fb4d4f
...
...
@@ -45,6 +45,7 @@ namespace typon
std
::
mutex
_mutex
;
std
::
atomic
<
Deque
*>
_active
{
nullptr
};
std
::
vector
<
Deque
*>
_pool
;
fdt
::
lock_free
::
garbage_collector
*
_gc
;
~
Worker
()
{
...
...
@@ -58,17 +59,17 @@ namespace typon
}
}
Deque
*
resume
(
Work
&
work
)
noexcept
void
resume
(
Work
&
work
)
noexcept
{
auto
active
=
_active
.
load
();
if
(
work
.
_state
==
Work
::
Resumable
)
{
_active
.
store
(
work
.
_deque
);
work
.
_deque
->
resume
();
if
(
active
)
{
return
active
;
_gc
->
retire
(
active
)
;
}
work
.
_deque
->
resume
();
}
else
{
...
...
@@ -78,7 +79,6 @@ namespace typon
}
work
.
_task
.
resume
();
}
return
nullptr
;
}
void
add
(
Deque
*
deque
)
noexcept
...
...
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