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
b56fa50e
Commit
b56fa50e
authored
Jun 03, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP Adapt and experiment in scheduler.hpp
parent
7b88cc0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
rt/include/typon/core/scheduler.hpp
rt/include/typon/core/scheduler.hpp
+30
-5
No files found.
rt/include/typon/core/scheduler.hpp
View file @
b56fa50e
...
@@ -55,7 +55,7 @@ namespace typon
...
@@ -55,7 +55,7 @@ namespace typon
Scheduler
&
scheduler
=
get
();
Scheduler
&
scheduler
=
get
();
WorkDeque
*
active
=
scheduler
.
_worker
[
thread_id
].
_active
.
load
();
WorkDeque
*
active
=
scheduler
.
_worker
[
thread_id
].
_active
.
load
();
Task
task
=
active
->
pop
();
Task
task
=
active
->
pop
();
if
(
task
.
match
(
fdt
::
lock_free
::
deque
<
Continuation
>::
Prune
)
)
if
(
task
.
get_flags
()
==
fdt
::
lock_free
::
deque
<
Continuation
>::
Resize
)
{
{
if
(
auto
array
=
active
->
shrink
())
if
(
auto
array
=
active
->
shrink
())
{
{
...
@@ -87,6 +87,7 @@ namespace typon
...
@@ -87,6 +87,7 @@ namespace typon
static
void
resume
(
WorkDeque
*
deque
)
noexcept
static
void
resume
(
WorkDeque
*
deque
)
noexcept
{
{
deque
->
_resumable
.
store
(
true
);
deque
->
_resumable
.
store
(
true
);
get
().
_notifyer
.
notify_one
();
}
}
std
::
atomic
<
uint
>
_actives
=
0
;
std
::
atomic
<
uint
>
_actives
=
0
;
...
@@ -161,10 +162,24 @@ namespace typon
...
@@ -161,10 +162,24 @@ namespace typon
_gc
.
leave
(
thread_id
);
_gc
.
leave
(
thread_id
);
}
}
void
detect_work
(
Work
&
work
)
noexcept
{
_gc
.
enter
(
thread_id
);
for
(
uint
id
=
0
;
id
<
_concurrency
;
id
++
)
{
work
=
_worker
[
id
].
try_steal
();
if
(
work
)
{
break
;
}
}
_gc
.
leave
(
thread_id
);
}
bool
wait_for_work
(
Work
&
work
)
noexcept
bool
wait_for_work
(
Work
&
work
)
noexcept
{
{
work
=
{};
work
=
{};
while
(
true
)
for
(;;
)
{
{
_thieves
.
fetch_add
(
1
);
_thieves
.
fetch_add
(
1
);
explore_work
(
work
);
explore_work
(
work
);
...
@@ -177,6 +192,16 @@ namespace typon
...
@@ -177,6 +192,16 @@ namespace typon
return
true
;
return
true
;
}
}
auto
key
=
_notifyer
.
prepare_wait
();
auto
key
=
_notifyer
.
prepare_wait
();
detect_work
(
work
);
if
(
work
)
{
_notifyer
.
cancel_wait
();
if
(
_thieves
.
fetch_sub
(
1
)
==
1
)
{
_notifyer
.
notify_one
();
}
return
true
;
}
if
(
_done
.
load
())
if
(
_done
.
load
())
{
{
_notifyer
.
cancel_wait
();
_notifyer
.
cancel_wait
();
...
@@ -192,9 +217,9 @@ namespace typon
...
@@ -192,9 +217,9 @@ namespace typon
continue
;
continue
;
}
}
}
}
_notifyer
.
cancel_wait
();
//
_notifyer.cancel_wait();
(
void
)
key
;
//
(void) key;
//
_notifyer.wait(key);
_notifyer
.
wait
(
key
);
}
}
}
}
};
};
...
...
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