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
fda37062
Commit
fda37062
authored
Jan 06, 2017
by
Matthias Vallentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support one-shot deletion of actor pool workers
parent
207460b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
libcaf_core/caf/actor_pool.hpp
libcaf_core/caf/actor_pool.hpp
+4
-3
libcaf_core/src/actor_pool.cpp
libcaf_core/src/actor_pool.cpp
+10
-0
No files found.
libcaf_core/caf/actor_pool.hpp
View file @
fda37062
...
...
@@ -40,8 +40,9 @@ namespace caf {
///
/// After construction, new workers can be added via `{'SYS', 'PUT', actor}`
/// messages, e.g., `send(my_pool, sys_atom::value, put_atom::value, worker)`.
/// `{'SYS', 'DELETE', actor}` messages remove a worker from the set,
/// whereas `{'SYS', 'GET'}` returns a `vector<actor>` containing all workers.
/// `{'SYS', 'DELETE', actor}` messages remove a specific worker from the set,
/// `{'SYS', 'DELETE'}` removes all workers, and `{'SYS', 'GET'}` returns a
/// `vector<actor>` containing all workers.
///
/// Note that the pool *always* sends exit messages to all of its workers
/// when forced to quit. The pool monitors all of its workers. Messages queued
...
...
@@ -49,7 +50,7 @@ namespace caf {
/// and resend messages. Advanced caching or resend strategies can be
/// implemented in a policy.
///
/// It is wort mentioning that the pool is *not* an event-based actor.
/// It is wort
h
mentioning that the pool is *not* an event-based actor.
/// Neither does it live in its own thread. Messages are dispatched immediately
/// during the enqueue operation. Any user-defined policy thus has to dispatch
/// messages with as little overhead as possible, because the dispatching
...
...
libcaf_core/src/actor_pool.cpp
View file @
fda37062
...
...
@@ -190,6 +190,16 @@ bool actor_pool::filter(upgrade_lock<detail::shared_spinlock>& guard,
}
return
true
;
}
if
(
content
.
match_elements
<
sys_atom
,
delete_atom
>
())
{
upgrade_to_unique_lock
<
detail
::
shared_spinlock
>
unique_guard
{
guard
};
for
(
auto
&
worker
:
workers_
)
{
default_attachable
::
observe_token
tk
{
address
(),
default_attachable
::
monitor
};
worker
->
detach
(
tk
);
}
workers_
.
clear
();
return
true
;
}
if
(
content
.
match_elements
<
sys_atom
,
get_atom
>
())
{
auto
cpy
=
workers_
;
guard
.
unlock
();
...
...
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