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
7ef13e96
Commit
7ef13e96
authored
Jul 16, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve logging of scheduler
parent
3fccabd8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
cppa/scheduler.hpp
cppa/scheduler.hpp
+25
-3
No files found.
cppa/scheduler.hpp
View file @
7ef13e96
...
...
@@ -185,7 +185,9 @@ class worker : public abstract_worker {
* @brief Attempt to steal an element from the exposed job queue.
*/
job_ptr
try_steal
()
override
{
return
m_queue_policy
.
try_external_dequeue
(
this
);
auto
result
=
m_queue_policy
.
try_external_dequeue
(
this
);
CPPA_LOG_DEBUG_IF
(
result
,
"stole actor with id "
<<
id_of
(
result
));
return
result
;
}
/**
...
...
@@ -193,6 +195,8 @@ class worker : public abstract_worker {
* source, i.e., from any other thread.
*/
void
external_enqueue
(
job_ptr
job
)
override
{
CPPA_REQUIRE
(
job
!=
nullptr
);
CPPA_LOG_TRACE
(
"id = "
<<
id
()
<<
" actor id "
<<
id_of
(
job
));
m_queue_policy
.
external_enqueue
(
this
,
job
);
}
...
...
@@ -203,12 +207,16 @@ class worker : public abstract_worker {
* @warning Must not be called from other threads.
*/
void
exec_later
(
job_ptr
job
)
override
{
CPPA_REQUIRE
(
job
!=
nullptr
);
CPPA_LOG_TRACE
(
"id = "
<<
id
()
<<
" actor id "
<<
id_of
(
job
));
m_queue_policy
.
internal_enqueue
(
this
,
job
);
}
// go on a raid in quest for a shiny new job
job_ptr
raid
()
{
return
m_steal_policy
.
raid
(
this
);
auto
result
=
m_steal_policy
.
raid
(
this
);
CPPA_LOG_DEBUG_IF
(
result
,
"got actor with id "
<<
id_of
(
result
));
return
result
;
}
inline
abstract_coordinator
*
parent
()
{
...
...
@@ -224,6 +232,7 @@ class worker : public abstract_worker {
}
void
detach_all
()
{
CPPA_LOG_TRACE
(
""
);
m_queue_policy
.
consume_all
(
this
,
[](
resumable
*
job
)
{
job
->
detach_from_scheduler
();
});
...
...
@@ -233,7 +242,18 @@ class worker : public abstract_worker {
m_id
=
id
;
m_parent
=
parent
;
auto
this_worker
=
this
;
m_this_thread
=
std
::
thread
{[
this_worker
]
{
this_worker
->
run
();
}};
m_this_thread
=
std
::
thread
{[
this_worker
]
{
CPPA_LOGC_TRACE
(
"cppa::scheduler::worker"
,
"start$lambda"
,
"id = "
<<
this_worker
->
id
());
this_worker
->
run
();
}};
}
actor_id
id_of
(
resumable
*
ptr
)
{
abstract_actor
*
aptr
=
ptr
?
dynamic_cast
<
abstract_actor
*>
(
ptr
)
:
nullptr
;
return
aptr
?
aptr
->
id
()
:
0
;
}
private:
...
...
@@ -243,6 +263,8 @@ class worker : public abstract_worker {
// scheduling loop
for
(;;)
{
auto
job
=
m_queue_policy
.
internal_dequeue
(
this
);
CPPA_REQUIRE
(
job
!=
nullptr
);
CPPA_LOG_DEBUG
(
"resume actor "
<<
id_of
(
job
));
CPPA_PUSH_AID_FROM_PTR
(
dynamic_cast
<
abstract_actor
*>
(
job
));
switch
(
job
->
resume
(
this
))
{
case
resumable
:
:
done
:
{
...
...
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