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
98c77c17
Commit
98c77c17
authored
Jan 27, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate all versions of `send_tuple`
parent
1a3de3f7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
56 deletions
+95
-56
libcaf_core/caf/detail/proper_actor.hpp
libcaf_core/caf/detail/proper_actor.hpp
+1
-1
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+54
-36
libcaf_core/caf/mixin/single_timeout.hpp
libcaf_core/caf/mixin/single_timeout.hpp
+1
-1
libcaf_core/caf/response_handle.hpp
libcaf_core/caf/response_handle.hpp
+1
-1
libcaf_core/caf/send.hpp
libcaf_core/caf/send.hpp
+29
-8
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+5
-5
unit_testing/test_spawn.cpp
unit_testing/test_spawn.cpp
+4
-4
No files found.
libcaf_core/caf/detail/proper_actor.hpp
View file @
98c77c17
...
...
@@ -301,7 +301,7 @@ class proper_actor<Base, Policies, true>
// auto e = this->new_mailbox_element(this, std::move(msg));
// this->m_mailbox.enqueue(e);
}
else
{
this
->
delayed_send
_tuple
(
this
,
d
,
std
::
move
(
msg
));
this
->
delayed_send
(
this
,
d
,
std
::
move
(
msg
));
}
m_pending_timeouts
.
push_back
(
tid
);
return
tid
;
...
...
libcaf_core/caf/local_actor.hpp
View file @
98c77c17
...
...
@@ -138,28 +138,16 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
}
/**************************************************************************
*
send asynchronous messages
*
*
send asynchronous messages
*
**************************************************************************/
/**
* Sends `what` to the receiver specified in `dest`.
*/
void
send_tuple
(
message_priority
prio
,
const
channel
&
whom
,
message
what
);
/**
* Sends `what` to the receiver specified in `dest`.
*/
inline
void
send_tuple
(
const
channel
&
whom
,
message
what
)
{
send_tuple
(
message_priority
::
normal
,
whom
,
std
::
move
(
what
));
}
/**
* Sends `{what...} to `whom` using the priority `prio`.
*/
template
<
class
...
Ts
>
inline
void
send
(
message_priority
prio
,
const
channel
&
whom
,
Ts
&&
...
what
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"sizeof...(Ts) == 0"
);
send_
tuple
(
prio
,
whom
,
make_message
(
std
::
forward
<
Ts
>
(
what
)...));
send_
impl
(
prio
,
whom
,
make_message
(
std
::
forward
<
Ts
>
(
what
)...));
}
/**
...
...
@@ -168,8 +156,8 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
template
<
class
...
Ts
>
inline
void
send
(
const
channel
&
whom
,
Ts
&&
...
what
)
{
static_assert
(
sizeof
...(
Ts
)
>
0
,
"sizeof...(Ts) == 0"
);
send_
tuple
(
message_priority
::
normal
,
whom
,
make_message
(
std
::
forward
<
Ts
>
(
what
)...));
send_
impl
(
message_priority
::
normal
,
whom
,
make_message
(
std
::
forward
<
Ts
>
(
what
)...));
}
/**
...
...
@@ -181,8 +169,8 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
detail
::
type_list
<
typename
detail
::
implicit_conversions
<
typename
std
::
decay
<
Ts
>::
type
>::
type
...
>
{});
send_
tuple
(
message_priority
::
normal
,
actor
{
whom
.
m_ptr
.
get
()},
make_message
(
std
::
forward
<
Ts
>
(
what
)...));
send_
impl
(
message_priority
::
normal
,
actor
{
whom
.
m_ptr
.
get
()},
make_message
(
std
::
forward
<
Ts
>
(
what
)...));
}
/**
...
...
@@ -205,21 +193,6 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
send_exit
(
whom
.
address
(),
reason
);
}
/**
* Sends a message to `whom` with priority `prio`
* that is delayed by `rel_time`.
*/
void
delayed_send_tuple
(
message_priority
prio
,
const
channel
&
whom
,
const
duration
&
rtime
,
message
data
);
/**
* Sends a message to `whom` that is delayed by `rel_time`.
*/
inline
void
delayed_send_tuple
(
const
channel
&
whom
,
const
duration
&
rtime
,
message
data
)
{
delayed_send_tuple
(
message_priority
::
normal
,
whom
,
rtime
,
std
::
move
(
data
));
}
/**
* Sends a message to `whom` using priority `prio`
* that is delayed by `rel_time`.
...
...
@@ -227,7 +200,7 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
template
<
class
...
Ts
>
void
delayed_send
(
message_priority
prio
,
const
channel
&
whom
,
const
duration
&
rtime
,
Ts
&&
...
args
)
{
delayed_send_
tuple
(
prio
,
whom
,
rtime
,
delayed_send_
impl
(
prio
,
whom
,
rtime
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...));
}
...
...
@@ -236,8 +209,8 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
*/
template
<
class
...
Ts
>
void
delayed_send
(
const
channel
&
whom
,
const
duration
&
rtime
,
Ts
&&
...
args
)
{
delayed_send_
tuple
(
message_priority
::
normal
,
whom
,
rtime
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...));
delayed_send_
impl
(
message_priority
::
normal
,
whom
,
rtime
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...));
}
/**************************************************************************
...
...
@@ -433,6 +406,24 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
attach
(
attachable_ptr
{
new
functor_attachable
(
std
::
move
(
f
))});
}
/**************************************************************************
* outdated member functions *
**************************************************************************/
// <backward_compatibility version="0.9">
inline
void
send_tuple
(
message_priority
prio
,
const
channel
&
whom
,
message
what
)
CAF_DEPRECATED
;
inline
void
send_tuple
(
const
channel
&
whom
,
message
what
)
CAF_DEPRECATED
;
inline
void
delayed_send_tuple
(
message_priority
prio
,
const
channel
&
whom
,
const
duration
&
rtime
,
message
data
)
CAF_DEPRECATED
;
inline
void
delayed_send_tuple
(
const
channel
&
whom
,
const
duration
&
rtime
,
message
data
)
CAF_DEPRECATED
;
// </backward_compatibility>
/**************************************************************************
* here be dragons: end of public interface *
**************************************************************************/
...
...
@@ -561,6 +552,9 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
/** @endcond */
private:
void
send_impl
(
message_priority
prio
,
const
channel
&
dest
,
message
&&
what
);
void
delayed_send_impl
(
message_priority
prio
,
const
channel
&
whom
,
const
duration
&
rtime
,
message
data
);
using
super
=
combined_type
;
std
::
function
<
void
()
>
m_sync_failure_handler
;
std
::
function
<
void
()
>
m_sync_timeout_handler
;
...
...
@@ -572,6 +566,30 @@ class local_actor : public extend<abstract_actor>::with<mixin::memory_cached> {
*/
using
local_actor_ptr
=
intrusive_ptr
<
local_actor
>
;
// <backward_compatibility version="0.9">
inline
void
local_actor
::
send_tuple
(
message_priority
prio
,
const
channel
&
whom
,
message
what
)
{
send_impl
(
prio
,
whom
,
std
::
move
(
what
));
}
inline
void
local_actor
::
send_tuple
(
const
channel
&
whom
,
message
what
)
{
send_impl
(
message_priority
::
normal
,
whom
,
std
::
move
(
what
));
}
inline
void
local_actor
::
delayed_send_tuple
(
message_priority
prio
,
const
channel
&
whom
,
const
duration
&
rtime
,
message
data
)
{
delayed_send_impl
(
prio
,
whom
,
rtime
,
std
::
move
(
data
));
}
inline
void
local_actor
::
delayed_send_tuple
(
const
channel
&
whom
,
const
duration
&
rtime
,
message
data
)
{
delayed_send_impl
(
message_priority
::
normal
,
whom
,
rtime
,
std
::
move
(
data
));
}
// </backward_compatibility>
}
// namespace caf
#endif // CAF_CONTEXT_HPP
libcaf_core/caf/mixin/single_timeout.hpp
View file @
98c77c17
...
...
@@ -54,7 +54,7 @@ class single_timeout : public Base {
this
->
enqueue
(
this
->
address
(),
invalid_message_id
,
std
::
move
(
msg
),
this
->
host
());
}
else
this
->
delayed_send
_tuple
(
this
,
d
,
std
::
move
(
msg
));
this
->
delayed_send
(
this
,
d
,
std
::
move
(
msg
));
}
else
this
->
has_timeout
(
false
);
}
...
...
libcaf_core/caf/response_handle.hpp
View file @
98c77c17
...
...
@@ -76,7 +76,7 @@ class response_handle<Self, message, nonblocking_response_handle_tag> {
std
::
forward
<
Ts
>
(
args
)...,
on
<
sync_timeout_msg
>
()
>>
[
selfptr
]()
->
skip_message_t
{
selfptr
->
handle_sync_timeout
();
return
{}
;
return
skip_message
()
;
}
};
m_self
->
bhvr_stack
().
push_back
(
std
::
move
(
bhvr
),
m_mid
);
...
...
libcaf_core/caf/send.hpp
View file @
98c77c17
...
...
@@ -33,6 +33,18 @@
namespace
caf
{
// mark outdated functions as deprecated
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message
msg
)
CAF_DEPRECATED
;
inline
void
send_tuple_as
(
const
actor
&
from
,
const
channel
&
to
,
message_priority
prio
,
message
msg
)
CAF_DEPRECATED
;
inline
void
anon_send_tuple
(
const
channel
&
to
,
message
msg
)
CAF_DEPRECATED
;
inline
void
anon_send_tuple
(
const
channel
&
to
,
message_priority
prio
,
message
msg
)
CAF_DEPRECATED
;
/**
* Sends `to` a message under the identity of `from`.
*/
...
...
@@ -54,29 +66,38 @@ inline void send_tuple_as(const actor& from, const channel& to,
}
/**
* Sends `to` a message under the identity of `from`.
* Sends `to` a message under the identity of `from`
with priority `prio`
.
*/
template
<
class
...
Ts
>
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
Ts
&&
...
args
)
{
send_tuple_as
(
from
,
to
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...));
void
send_as
(
const
actor
&
from
,
message_priority
prio
,
const
channel
&
to
,
Ts
&&
...
args
)
{
if
(
!
to
)
{
return
;
}
message_id
mid
;
to
->
enqueue
(
from
.
address
(),
prio
==
message_priority
::
high
?
mid
.
with_high_priority
()
:
mid
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...),
nullptr
);
}
/**
* Sends `to` a message under the identity of `from`.
*/
template
<
class
...
Ts
>
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
message_priority
prio
,
Ts
&&
...
args
)
{
send_tuple_as
(
from
,
to
,
prio
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...));
void
send_as
(
const
actor
&
from
,
const
channel
&
to
,
Ts
&&
...
args
)
{
send_as
(
from
,
to
,
make_message
(
std
::
forward
<
Ts
>
(
args
)...));
}
/**
* Anonymously sends `to` a message.
*/
inline
void
anon_send_tuple
(
const
channel
&
to
,
message
msg
)
{
send_
tuple_
as
(
invalid_actor
,
to
,
std
::
move
(
msg
));
send_as
(
invalid_actor
,
to
,
std
::
move
(
msg
));
}
inline
void
anon_send_tuple
(
const
channel
&
to
,
message_priority
prio
,
message
msg
)
{
send_
tuple_
as
(
invalid_actor
,
to
,
prio
,
std
::
move
(
msg
));
send_as
(
invalid_actor
,
to
,
prio
,
std
::
move
(
msg
));
}
/**
...
...
libcaf_core/src/local_actor.cpp
View file @
98c77c17
...
...
@@ -105,7 +105,7 @@ void local_actor::reply_message(message&& what) {
}
auto
&
mid
=
m_current_node
->
mid
;
if
(
mid
.
valid
()
==
false
||
mid
.
is_response
())
{
send
_tuple
(
actor_cast
<
channel
>
(
whom
),
std
::
move
(
what
));
send
(
actor_cast
<
channel
>
(
whom
),
std
::
move
(
what
));
}
else
if
(
!
mid
.
is_answered
())
{
auto
ptr
=
actor_cast
<
actor
>
(
whom
);
ptr
->
enqueue
(
address
(),
mid
.
response_id
(),
std
::
move
(
what
),
host
());
...
...
@@ -125,8 +125,8 @@ void local_actor::forward_message(const actor& dest, message_priority prio) {
m_current_node
->
mid
=
invalid_message_id
;
}
void
local_actor
::
send_
tuple
(
message_priority
prio
,
const
channel
&
dest
,
message
what
)
{
void
local_actor
::
send_
impl
(
message_priority
prio
,
const
channel
&
dest
,
message
&&
what
)
{
if
(
!
dest
)
{
return
;
}
...
...
@@ -141,8 +141,8 @@ void local_actor::send_exit(const actor_addr& whom, uint32_t reason) {
send
(
actor_cast
<
actor
>
(
whom
),
exit_msg
{
address
(),
reason
});
}
void
local_actor
::
delayed_send_
tuple
(
message_priority
prio
,
const
channel
&
dest
,
const
duration
&
rel_time
,
message
msg
)
{
void
local_actor
::
delayed_send_
impl
(
message_priority
prio
,
const
channel
&
dest
,
const
duration
&
rel_time
,
message
msg
)
{
message_id
mid
;
if
(
prio
==
message_priority
::
high
)
{
mid
=
mid
.
with_high_priority
();
...
...
unit_testing/test_spawn.cpp
View file @
98c77c17
...
...
@@ -283,7 +283,7 @@ void test_spawn() {
CAF_PRINT
(
"test self->send()"
);
self
->
send
(
self
,
1
,
2
,
3
,
true
);
self
->
receive
(
on
(
1
,
2
,
3
,
true
)
>>
[]
{
});
self
->
send
_tuple
(
self
,
message
{});
self
->
send
(
self
,
message
{});
self
->
receive
(
on
()
>>
[]
{
});
self
->
await_all_other_actors_done
();
CAF_CHECKPOINT
();
...
...
@@ -472,8 +472,8 @@ void test_spawn() {
);
// kill joe and bob
auto
poison_pill
=
make_message
(
atom
(
"done"
));
anon_send
_tuple
(
joe
,
poison_pill
);
anon_send
_tuple
(
bob
,
poison_pill
);
anon_send
(
joe
,
poison_pill
);
anon_send
(
bob
,
poison_pill
);
self
->
await_all_other_actors_done
();
function
<
actor
(
const
string
&
,
const
actor
&
)
>
spawn_next
;
...
...
@@ -489,7 +489,7 @@ void test_spawn() {
s
->
become
(
others
()
>>
[
=
]
{
// forward message and die
s
->
send
_tuple
(
pal
,
s
->
last_dequeued
());
s
->
send
(
pal
,
s
->
last_dequeued
());
s
->
quit
();
}
);
...
...
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