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
199aa7f2
Commit
199aa7f2
authored
Sep 22, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support ASIO-like post()/dispatch() in multiplexer
parent
3a88e9f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
libcaf_io/caf/io/middleman.hpp
libcaf_io/caf/io/middleman.hpp
+2
-2
libcaf_io/caf/io/network/multiplexer.hpp
libcaf_io/caf/io/network/multiplexer.hpp
+8
-0
No files found.
libcaf_io/caf/io/middleman.hpp
View file @
199aa7f2
...
...
@@ -78,7 +78,7 @@ class middleman : public detail::abstract_singleton {
*/
template
<
class
F
>
void
run_later
(
F
fun
)
{
m_backend
->
dispatch
(
fun
);
m_backend
->
post
(
fun
);
}
/**
...
...
@@ -105,7 +105,7 @@ class middleman : public detail::abstract_singleton {
void
add_hook
(
Ts
&&
...
args
)
{
// if only we could move a unique_ptr into a lambda in C++11
auto
ptr
=
new
C
(
std
::
forward
<
Ts
>
(
args
)...);
run_later
([
=
]
{
backend
().
dispatch
([
=
]
{
ptr
->
next
.
swap
(
m_hooks
);
m_hooks
.
reset
(
ptr
);
});
...
...
libcaf_io/caf/io/network/multiplexer.hpp
View file @
199aa7f2
...
...
@@ -122,6 +122,14 @@ class multiplexer {
fun
();
return
;
}
post
(
std
::
move
(
fun
));
}
/**
* Invokes @p fun in the multiplexer's event loop.
*/
template
<
class
F
>
void
post
(
F
fun
)
{
struct
impl
:
runnable
{
F
f
;
impl
(
F
&&
mf
)
:
f
(
std
::
move
(
mf
))
{
}
...
...
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