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
85421ab3
You need to sign in or sign up before continuing.
Commit
85421ab3
authored
May 24, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support custom blocking actors in mixin::requester
parent
de6aae61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
libcaf_core/caf/blocking_actor.hpp
libcaf_core/caf/blocking_actor.hpp
+10
-0
libcaf_core/caf/mixin/requester.hpp
libcaf_core/caf/mixin/requester.hpp
+7
-1
libcaf_core/caf/response_handle.hpp
libcaf_core/caf/response_handle.hpp
+1
-12
No files found.
libcaf_core/caf/blocking_actor.hpp
View file @
85421ab3
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <mutex>
#include <mutex>
#include <condition_variable>
#include <condition_variable>
#include "caf/fwd.hpp"
#include "caf/send.hpp"
#include "caf/send.hpp"
#include "caf/none.hpp"
#include "caf/none.hpp"
#include "caf/extend.hpp"
#include "caf/extend.hpp"
...
@@ -38,6 +39,15 @@
...
@@ -38,6 +39,15 @@
#include "caf/mixin/sender.hpp"
#include "caf/mixin/sender.hpp"
#include "caf/mixin/requester.hpp"
#include "caf/mixin/requester.hpp"
namespace
caf
{
namespace
mixin
{
template
<
>
struct
is_blocking_requester
<
blocking_actor
>
:
std
::
true_type
{
};
}
// namespace caf
}
// namespace mixin
namespace
caf
{
namespace
caf
{
/// A thread-mapped or context-switching actor using a blocking
/// A thread-mapped or context-switching actor using a blocking
...
...
libcaf_core/caf/mixin/requester.hpp
View file @
85421ab3
...
@@ -34,6 +34,9 @@
...
@@ -34,6 +34,9 @@
namespace
caf
{
namespace
caf
{
namespace
mixin
{
namespace
mixin
{
template
<
class
T
>
struct
is_blocking_requester
:
std
::
false_type
{
};
/// A `requester` is an actor that supports
/// A `requester` is an actor that supports
/// `self->request(...).{then|await|receive}`.
/// `self->request(...).{then|await|receive}`.
template
<
class
Base
,
class
Subtype
>
template
<
class
Base
,
class
Subtype
>
...
@@ -44,6 +47,8 @@ public:
...
@@ -44,6 +47,8 @@ public:
// nop
// nop
}
}
static
constexpr
bool
is_blocking_subtype
=
is_blocking_requester
<
Subtype
>::
value
;
/// Sends `{xs...}` as a synchronous message to `dest` with priority `mp`.
/// Sends `{xs...}` as a synchronous message to `dest` with priority `mp`.
/// @returns A handle identifying a future-like handle to the response.
/// @returns A handle identifying a future-like handle to the response.
/// @warning The returned handle is actor specific and the response to the
/// @warning The returned handle is actor specific and the response to the
...
@@ -57,7 +62,8 @@ public:
...
@@ -57,7 +62,8 @@ public:
typename
detail
::
implicit_conversions
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
Ts
>::
type
typename
std
::
decay
<
Ts
>::
type
>::
type
...
>
>::
type
...
>
>::
type
>
>::
type
,
is_blocking_subtype
>
request
(
const
Handle
&
dest
,
const
duration
&
timeout
,
Ts
&&
...
xs
)
{
request
(
const
Handle
&
dest
,
const
duration
&
timeout
,
Ts
&&
...
xs
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
static_assert
(
sizeof
...(
Ts
)
>
0
,
"no message to send"
);
using
token
=
using
token
=
...
...
libcaf_core/caf/response_handle.hpp
View file @
85421ab3
...
@@ -34,20 +34,9 @@
...
@@ -34,20 +34,9 @@
namespace
caf
{
namespace
caf
{
/// This tag identifies response handles featuring a
/// nonblocking API by providing a `then` member function.
/// @relates response_handle
struct
nonblocking_response_handle_tag
{};
/// This tag identifies response handles featuring a
/// blocking API by providing an `await` member function.
/// @relates response_handle
struct
blocking_response_handle_tag
{};
/// This helper class identifies an expected response message
/// This helper class identifies an expected response message
/// and enables `request(...).then(...)`.
/// and enables `request(...).then(...)`.
template
<
class
Self
,
class
Output
,
template
<
class
Self
,
class
Output
,
bool
IsBlocking
>
bool
IsBlocking
=
std
::
is_same
<
Self
,
blocking_actor
>
::
value
>
class
response_handle
;
class
response_handle
;
/******************************************************************************
/******************************************************************************
...
...
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