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
8fa01471
Commit
8fa01471
authored
Sep 14, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix synchronization on the bounded buffer
parent
4c68deb8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
libcaf_core/caf/async/bounded_buffer.hpp
libcaf_core/caf/async/bounded_buffer.hpp
+2
-0
libcaf_core/caf/flow/observable.hpp
libcaf_core/caf/flow/observable.hpp
+21
-3
libcaf_core/src/flow/scoped_coordinator.cpp
libcaf_core/src/flow/scoped_coordinator.cpp
+4
-2
No files found.
libcaf_core/caf/async/bounded_buffer.hpp
View file @
8fa01471
...
...
@@ -72,6 +72,7 @@ public:
std
::
unique_lock
guard
{
mtx_
};
CAF_ASSERT
(
producer_
!=
nullptr
);
CAF_ASSERT
(
!
closed_
);
CAF_ASSERT
(
wr_pos_
+
items
.
size
()
<
max_in_flight_
*
2
);
std
::
uninitialized_copy
(
items
.
begin
(),
items
.
end
(),
buf_
+
wr_pos_
);
wr_pos_
+=
items
.
size
();
if
(
size
()
==
items
.
size
()
&&
consumer_
)
...
...
@@ -204,6 +205,7 @@ private:
consumer_
->
on_producer_ready
();
if
(
!
empty
())
consumer_
->
on_producer_wakeup
();
signal_demand
(
max_in_flight_
);
}
size_t
empty
()
const
noexcept
{
...
...
libcaf_core/caf/flow/observable.hpp
View file @
8fa01471
...
...
@@ -152,6 +152,24 @@ public:
template
<
class
Step
>
transformation
<
Step
>
transform
(
Step
step
);
/// Registers a callback for `on_complete` events.
template
<
class
F
>
auto
do_on_complete
(
F
f
)
{
return
transform
(
on_complete_step
<
T
,
F
>
{
std
::
move
(
f
)});
}
/// Registers a callback for `on_error` events.
template
<
class
F
>
auto
do_on_error
(
F
f
)
{
return
transform
(
on_error_step
<
T
,
F
>
{
std
::
move
(
f
)});
}
/// Registers a callback that runs on `on_complete` or `on_error`.
template
<
class
F
>
auto
do_finally
(
F
f
)
{
return
transform
(
finally_step
<
T
,
F
>
{
std
::
move
(
f
)});
}
/// Returns a transformation that selects only the first `n` items.
transformation
<
limit_step
<
T
>>
take
(
size_t
n
);
...
...
@@ -969,19 +987,19 @@ public:
}
template
<
class
F
>
auto
do_on_complete
(
F
f
)
{
auto
do_on_complete
(
F
f
)
&&
{
return
std
::
move
(
*
this
)
//
.
transform
(
on_complete_step
<
output_type
,
F
>
{
std
::
move
(
f
)});
}
template
<
class
F
>
auto
do_on_error
(
F
f
)
{
auto
do_on_error
(
F
f
)
&&
{
return
std
::
move
(
*
this
)
//
.
transform
(
on_error_step
<
output_type
,
F
>
{
std
::
move
(
f
)});
}
template
<
class
F
>
auto
do_finally
(
F
f
)
{
auto
do_finally
(
F
f
)
&&
{
return
std
::
move
(
*
this
)
//
.
transform
(
finally_step
<
output_type
,
F
>
{
std
::
move
(
f
)});
}
...
...
libcaf_core/src/flow/scoped_coordinator.cpp
View file @
8fa01471
...
...
@@ -21,11 +21,13 @@ void scoped_coordinator::run() {
};
for
(;;)
{
auto
hdl
=
next
(
!
watched_disposables_
.
empty
());
if
(
hdl
.
ptr
()
!=
nullptr
)
if
(
hdl
.
ptr
()
!=
nullptr
)
{
hdl
.
run
();
else
drop_disposed_flows
();
}
else
{
return
;
}
}
}
void
scoped_coordinator
::
ref_coordinator
()
const
noexcept
{
...
...
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