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
00fba84a
Commit
00fba84a
authored
May 15, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce lookup cycles when closing slots
parent
eaa3ba2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
7 deletions
+26
-7
libcaf_core/caf/downstream_manager.hpp
libcaf_core/caf/downstream_manager.hpp
+4
-0
libcaf_core/src/downstream_manager.cpp
libcaf_core/src/downstream_manager.cpp
+22
-7
No files found.
libcaf_core/caf/downstream_manager.hpp
View file @
00fba84a
...
...
@@ -103,6 +103,10 @@ public:
/// Returns all used slots.
std
::
vector
<
stream_slot
>
path_slots
();
/// Returns all open slots, i.e., slots assigned to outbound paths with
/// `closing == false`.
std
::
vector
<
stream_slot
>
open_path_slots
();
/// Checks whether `predicate` holds true for all paths.
template
<
class
Predicate
>
bool
all_paths
(
Predicate
predicate
)
const
noexcept
{
...
...
libcaf_core/src/downstream_manager.cpp
View file @
00fba84a
...
...
@@ -73,6 +73,16 @@ std::vector<stream_slot> downstream_manager::path_slots() {
return
xs
;
}
std
::
vector
<
stream_slot
>
downstream_manager
::
open_path_slots
()
{
std
::
vector
<
stream_slot
>
xs
;
xs
.
reserve
(
num_paths
());
for_each_path
([
&
](
outbound_path
&
x
)
{
if
(
!
x
.
closing
)
xs
.
emplace_back
(
x
.
slots
.
sender
);
});
return
xs
;
}
size_t
downstream_manager
::
num_paths
()
const
noexcept
{
return
0
;
}
...
...
@@ -113,20 +123,25 @@ bool downstream_manager::clean(stream_slot slot) const noexcept {
void
downstream_manager
::
close
()
{
CAF_LOG_TRACE
(
""
);
auto
slots
=
path_slots
();
for
(
auto
slot
:
slots
)
auto
open_slots
=
open_
path_slots
();
for
(
auto
slot
:
open_
slots
)
close
(
slot
);
}
void
downstream_manager
::
close
(
stream_slot
slot
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
slot
));
if
(
clean
(
slot
))
auto
ptr
=
path
(
slot
);
if
(
ptr
==
nullptr
)
{
CAF_LOG_DEBUG
(
"cannot close unknown slot:"
<<
slot
);
return
;
}
if
(
buffered
(
slot
)
==
0
&&
ptr
->
clean
())
{
CAF_LOG_DEBUG
(
"path clean, remove immediately;"
<<
CAF_ARG
(
slot
));
remove_path
(
slot
,
none
,
false
);
else
{
auto
ptr
=
path
(
slot
);
if
(
ptr
!=
nullptr
)
ptr
->
closing
=
true
;
return
;
}
CAF_LOG_DEBUG
(
"path not clean, set to closing;"
<<
CAF_ARG
(
slot
));
ptr
->
closing
=
true
;
}
void
downstream_manager
::
abort
(
error
reason
)
{
...
...
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