Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
cff96757
Commit
cff96757
authored
Jan 18, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1017
parents
797df940
c1b9ee3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
libcaf_core/src/scheduler/test_coordinator.cpp
libcaf_core/src/scheduler/test_coordinator.cpp
+12
-1
No files found.
libcaf_core/src/scheduler/test_coordinator.cpp
View file @
cff96757
...
@@ -75,6 +75,7 @@ detail::test_actor_clock& test_coordinator::clock() noexcept {
...
@@ -75,6 +75,7 @@ detail::test_actor_clock& test_coordinator::clock() noexcept {
}
}
void
test_coordinator
::
start
()
{
void
test_coordinator
::
start
()
{
CAF_LOG_TRACE
(
""
);
dummy_worker
worker
{
this
};
dummy_worker
worker
{
this
};
actor_config
cfg
{
&
worker
};
actor_config
cfg
{
&
worker
};
auto
&
sys
=
system
();
auto
&
sys
=
system
();
...
@@ -84,6 +85,7 @@ void test_coordinator::start() {
...
@@ -84,6 +85,7 @@ void test_coordinator::start() {
}
}
void
test_coordinator
::
stop
()
{
void
test_coordinator
::
stop
()
{
CAF_LOG_TRACE
(
""
);
while
(
run
()
>
0
)
while
(
run
()
>
0
)
trigger_timeouts
();
trigger_timeouts
();
}
}
...
@@ -92,6 +94,7 @@ void test_coordinator::enqueue(resumable* ptr) {
...
@@ -92,6 +94,7 @@ void test_coordinator::enqueue(resumable* ptr) {
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
jobs
.
push_back
(
ptr
);
jobs
.
push_back
(
ptr
);
if
(
after_next_enqueue_
!=
nullptr
)
{
if
(
after_next_enqueue_
!=
nullptr
)
{
CAF_LOG_DEBUG
(
"inline this enqueue"
);
std
::
function
<
void
()
>
f
;
std
::
function
<
void
()
>
f
;
f
.
swap
(
after_next_enqueue_
);
f
.
swap
(
after_next_enqueue_
);
f
();
f
();
...
@@ -99,6 +102,7 @@ void test_coordinator::enqueue(resumable* ptr) {
...
@@ -99,6 +102,7 @@ void test_coordinator::enqueue(resumable* ptr) {
}
}
bool
test_coordinator
::
try_run_once
()
{
bool
test_coordinator
::
try_run_once
()
{
CAF_LOG_TRACE
(
""
);
if
(
jobs
.
empty
())
if
(
jobs
.
empty
())
return
false
;
return
false
;
auto
job
=
jobs
.
front
();
auto
job
=
jobs
.
front
();
...
@@ -119,6 +123,7 @@ bool test_coordinator::try_run_once() {
...
@@ -119,6 +123,7 @@ bool test_coordinator::try_run_once() {
}
}
bool
test_coordinator
::
try_run_once_lifo
()
{
bool
test_coordinator
::
try_run_once_lifo
()
{
CAF_LOG_TRACE
(
""
);
if
(
jobs
.
empty
())
if
(
jobs
.
empty
())
return
false
;
return
false
;
if
(
jobs
.
size
()
>=
2
)
if
(
jobs
.
size
()
>=
2
)
...
@@ -127,18 +132,21 @@ bool test_coordinator::try_run_once_lifo() {
...
@@ -127,18 +132,21 @@ bool test_coordinator::try_run_once_lifo() {
}
}
void
test_coordinator
::
run_once
()
{
void
test_coordinator
::
run_once
()
{
CAF_LOG_TRACE
(
""
);
if
(
jobs
.
empty
())
if
(
jobs
.
empty
())
CAF_RAISE_ERROR
(
"No job to run available."
);
CAF_RAISE_ERROR
(
"No job to run available."
);
try_run_once
();
try_run_once
();
}
}
void
test_coordinator
::
run_once_lifo
()
{
void
test_coordinator
::
run_once_lifo
()
{
CAF_LOG_TRACE
(
""
);
if
(
jobs
.
empty
())
if
(
jobs
.
empty
())
CAF_RAISE_ERROR
(
"No job to run available."
);
CAF_RAISE_ERROR
(
"No job to run available."
);
try_run_once_lifo
();
try_run_once_lifo
();
}
}
size_t
test_coordinator
::
run
(
size_t
max_count
)
{
size_t
test_coordinator
::
run
(
size_t
max_count
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
max_count
));
size_t
res
=
0
;
size_t
res
=
0
;
while
(
res
<
max_count
&&
try_run_once
())
while
(
res
<
max_count
&&
try_run_once
())
++
res
;
++
res
;
...
@@ -146,16 +154,19 @@ size_t test_coordinator::run(size_t max_count) {
...
@@ -146,16 +154,19 @@ size_t test_coordinator::run(size_t max_count) {
}
}
void
test_coordinator
::
inline_next_enqueue
()
{
void
test_coordinator
::
inline_next_enqueue
()
{
CAF_LOG_TRACE
(
""
);
after_next_enqueue
([
=
]
{
run_once_lifo
();
});
after_next_enqueue
([
=
]
{
run_once_lifo
();
});
}
}
void
test_coordinator
::
inline_all_enqueues
()
{
void
test_coordinator
::
inline_all_enqueues
()
{
CAF_LOG_TRACE
(
""
);
after_next_enqueue
([
=
]
{
inline_all_enqueues_helper
();
});
after_next_enqueue
([
=
]
{
inline_all_enqueues_helper
();
});
}
}
void
test_coordinator
::
inline_all_enqueues_helper
()
{
void
test_coordinator
::
inline_all_enqueues_helper
()
{
run_once_lifo
(
);
CAF_LOG_TRACE
(
""
);
after_next_enqueue
([
=
]
{
inline_all_enqueues_helper
();
});
after_next_enqueue
([
=
]
{
inline_all_enqueues_helper
();
});
run_once_lifo
();
}
}
}
// namespace scheduler
}
// namespace scheduler
...
...
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