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
0ba4153a
Commit
0ba4153a
authored
Jan 10, 2018
by
Dominik Charousset
Committed by
Dominik Charousset
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch logger to the new DRR API
parent
d35be7ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
libcaf_core/caf/logger.hpp
libcaf_core/caf/logger.hpp
+2
-2
libcaf_core/src/logger.cpp
libcaf_core/src/logger.cpp
+17
-12
No files found.
libcaf_core/caf/logger.hpp
View file @
0ba4153a
...
...
@@ -37,9 +37,9 @@
#include "caf/abstract_actor.hpp"
#include "caf/deep_to_string.hpp"
#include "caf/intrusive/drr_queue.hpp"
#include "caf/intrusive/fifo_inbox.hpp"
#include "caf/intrusive/singly_linked.hpp"
#include "caf/intrusive/task_queue.hpp"
#include "caf/detail/arg_wrapper.hpp"
#include "caf/detail/pretty_type_name.hpp"
...
...
@@ -114,7 +114,7 @@ public:
using
unique_pointer
=
std
::
unique_ptr
<
event
,
deleter_type
>
;
using
queue_type
=
intrusive
::
task
_queue
<
policy
>
;
using
queue_type
=
intrusive
::
drr
_queue
<
policy
>
;
using
deficit_type
=
long
;
...
...
libcaf_core/src/logger.cpp
View file @
0ba4153a
...
...
@@ -36,6 +36,8 @@
#include "caf/string_algorithms.hpp"
#include "caf/actor_system_config.hpp"
#include "caf/intrusive/task_result.hpp"
#include "caf/detail/get_process_id.hpp"
#include "caf/detail/pretty_type_name.hpp"
...
...
@@ -398,18 +400,21 @@ void logger::run() {
#if defined(CAF_LOG_LEVEL)
log_first_line
();
// receive log entries from other threads and actors
std
::
unique_ptr
<
event
>
ptr
;
for
(;;)
{
// make sure we have data to read
queue_
.
synchronized_await
(
queue_mtx_
,
queue_cv_
);
// read & process event
ptr
.
reset
(
queue_
.
try_pop
());
CAF_ASSERT
(
ptr
!=
nullptr
);
bool
stop
=
false
;
auto
f
=
[
&
](
event
&
x
)
{
// empty message means: shut down
if
(
ptr
->
message
.
empty
())
break
;
handle_event
(
*
ptr
);
}
if
(
x
.
message
.
empty
())
{
stop
=
true
;
return
intrusive
::
task_result
::
stop
;
}
handle_event
(
x
);
return
intrusive
::
task_result
::
resume
;
};
do
{
// make sure we have data to read and consume events
queue_
.
synchronized_await
(
queue_mtx_
,
queue_cv_
);
queue_
.
new_round
(
1000
,
f
);
}
while
(
!
stop
);
log_last_line
();
#endif
}
...
...
@@ -534,7 +539,7 @@ void logger::stop() {
if
(
!
thread_
.
joinable
())
return
;
// an empty string means: shut down
queue_
.
synchronized_
enqueue
(
queue_mtx_
,
queue_cv_
,
new
event
);
queue_
.
synchronized_
push_back
(
queue_mtx_
,
queue_cv_
,
new
event
);
thread_
.
join
();
#endif
}
...
...
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