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
92a58cae
Commit
92a58cae
authored
Jun 27, 2019
by
Dominik Charousset
Committed by
Dominik Charousset
Jun 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make BASP workers reference counted
parent
2a378bfc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
libcaf_io/caf/io/basp/worker.hpp
libcaf_io/caf/io/basp/worker.hpp
+3
-1
libcaf_io/src/worker.cpp
libcaf_io/src/worker.cpp
+3
-3
libcaf_io/src/worker_hub.cpp
libcaf_io/src/worker_hub.cpp
+1
-1
No files found.
libcaf_io/caf/io/basp/worker.hpp
View file @
92a58cae
...
...
@@ -35,7 +35,9 @@ namespace io {
namespace
basp
{
/// Deserializes payloads for BASP messages asynchronously.
class
worker
:
public
resumable
,
public
remote_message_handler
<
worker
>
{
class
worker
:
public
resumable
,
public
remote_message_handler
<
worker
>
,
public
ref_counted
{
public:
// -- friends ----------------------------------------------------------------
...
...
libcaf_io/src/worker.cpp
View file @
92a58cae
...
...
@@ -54,6 +54,7 @@ void worker::launch(const node_id& last_hop, const basp::header& hdr,
last_hop_
=
last_hop
;
memcpy
(
&
hdr_
,
&
hdr
,
sizeof
(
basp
::
header
));
payload_
.
assign
(
payload
.
begin
(),
payload
.
end
());
ref
();
system_
->
scheduler
().
enqueue
(
this
);
}
...
...
@@ -71,12 +72,11 @@ resumable::resume_result worker::resume(execution_unit* ctx, size_t) {
}
void
worker
::
intrusive_ptr_add_ref_impl
()
{
// The basp::instance owns the hub (which owns this object) and must make
// sure to wait for pending workers at exit.
ref
();
}
void
worker
::
intrusive_ptr_release_impl
()
{
// nop
deref
();
}
}
// namespace basp
...
...
libcaf_io/src/worker_hub.cpp
View file @
92a58cae
...
...
@@ -35,7 +35,7 @@ worker_hub::~worker_hub() {
auto
head
=
head_
.
load
();
while
(
head
!=
nullptr
)
{
auto
next
=
head
->
next_
.
load
();
delete
head
;
head
->
intrusive_ptr_release_impl
()
;
head
=
next
;
}
}
...
...
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