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
9fd915cf
Commit
9fd915cf
authored
Sep 16, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give actor its default ctor back
parent
bf12adc5
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
70 additions
and
150 deletions
+70
-150
libcaf_core/caf/actor.hpp
libcaf_core/caf/actor.hpp
+8
-12
libcaf_core/caf/actor_addr.hpp
libcaf_core/caf/actor_addr.hpp
+1
-16
libcaf_core/caf/actor_cast.hpp
libcaf_core/caf/actor_cast.hpp
+2
-22
libcaf_core/caf/actor_factory.hpp
libcaf_core/caf/actor_factory.hpp
+1
-1
libcaf_core/caf/function_view.hpp
libcaf_core/caf/function_view.hpp
+0
-5
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+2
-2
libcaf_core/caf/intrusive_ptr.hpp
libcaf_core/caf/intrusive_ptr.hpp
+0
-3
libcaf_core/caf/mixin/requester.hpp
libcaf_core/caf/mixin/requester.hpp
+10
-4
libcaf_core/caf/mixin/sender.hpp
libcaf_core/caf/mixin/sender.hpp
+14
-10
libcaf_core/caf/scoped_actor.hpp
libcaf_core/caf/scoped_actor.hpp
+4
-3
libcaf_core/caf/send.hpp
libcaf_core/caf/send.hpp
+9
-5
libcaf_core/caf/system_messages.hpp
libcaf_core/caf/system_messages.hpp
+2
-46
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+5
-3
libcaf_core/caf/typed_actor_pointer.hpp
libcaf_core/caf/typed_actor_pointer.hpp
+4
-0
libcaf_core/caf/weak_intrusive_ptr.hpp
libcaf_core/caf/weak_intrusive_ptr.hpp
+0
-3
libcaf_core/src/actor.cpp
libcaf_core/src/actor.cpp
+1
-1
libcaf_core/test/actor_termination.cpp
libcaf_core/test/actor_termination.cpp
+1
-2
libcaf_core/test/parse_ini.cpp
libcaf_core/test/parse_ini.cpp
+1
-1
libcaf_core/test/splitter.cpp
libcaf_core/test/splitter.cpp
+1
-6
libcaf_io/test/basp.cpp
libcaf_io/test/basp.cpp
+1
-1
libcaf_io/test/http_broker.cpp
libcaf_io/test/http_broker.cpp
+1
-2
libcaf_io/test/unpublish.cpp
libcaf_io/test/unpublish.cpp
+2
-2
No files found.
libcaf_core/caf/actor.hpp
View file @
9fd915cf
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <utility>
#include <utility>
#include <type_traits>
#include <type_traits>
#include "caf/config.hpp"
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
#include "caf/message.hpp"
#include "caf/message.hpp"
...
@@ -64,12 +65,6 @@ public:
...
@@ -64,12 +65,6 @@ public:
// -- friend types that need access to private ctors
// -- friend types that need access to private ctors
friend
class
local_actor
;
friend
class
local_actor
;
template
<
class
>
friend
class
data_processor
;
template
<
class
>
friend
class
detail
::
type_erased_value_impl
;
using
signatures
=
none_t
;
using
signatures
=
none_t
;
// allow conversion via actor_cast
// allow conversion via actor_cast
...
@@ -79,9 +74,7 @@ public:
...
@@ -79,9 +74,7 @@ public:
// tell actor_cast which semantic this type uses
// tell actor_cast which semantic this type uses
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
// tell actor_cast this is a non-null handle type
actor
()
=
default
;
static
constexpr
bool
has_non_null_guarantee
=
true
;
actor
(
actor
&&
)
=
default
;
actor
(
actor
&&
)
=
default
;
actor
(
const
actor
&
)
=
default
;
actor
(
const
actor
&
)
=
default
;
actor
&
operator
=
(
actor
&&
)
=
default
;
actor
&
operator
=
(
actor
&&
)
=
default
;
...
@@ -89,7 +82,7 @@ public:
...
@@ -89,7 +82,7 @@ public:
actor
(
const
scoped_actor
&
);
actor
(
const
scoped_actor
&
);
explicit
actor
(
const
unsafe_actor_handle_init_t
&
);
explicit
actor
(
const
unsafe_actor_handle_init_t
&
)
CAF_DEPRECATED
;
template
<
class
T
,
template
<
class
T
,
class
=
typename
std
::
enable_if
<
class
=
typename
std
::
enable_if
<
...
@@ -117,6 +110,11 @@ public:
...
@@ -117,6 +110,11 @@ public:
actor
&
operator
=
(
const
scoped_actor
&
x
);
actor
&
operator
=
(
const
scoped_actor
&
x
);
/// Queries whether this actor handle is valid.
inline
explicit
operator
bool
()
const
{
return
static_cast
<
bool
>
(
ptr_
);
}
/// Returns the address of the stored actor.
/// Returns the address of the stored actor.
actor_addr
address
()
const
noexcept
;
actor_addr
address
()
const
noexcept
;
...
@@ -175,8 +173,6 @@ public:
...
@@ -175,8 +173,6 @@ public:
}
}
private:
private:
actor
()
=
default
;
inline
actor_control_block
*
get
()
const
noexcept
{
inline
actor_control_block
*
get
()
const
noexcept
{
return
ptr_
.
get
();
return
ptr_
.
get
();
}
}
...
...
libcaf_core/caf/actor_addr.hpp
View file @
9fd915cf
...
@@ -43,17 +43,7 @@ class actor_addr : detail::comparable<actor_addr>,
...
@@ -43,17 +43,7 @@ class actor_addr : detail::comparable<actor_addr>,
public:
public:
// -- friend types that need access to private ctors
// -- friend types that need access to private ctors
template
<
class
>
friend
class
detail
::
type_erased_value_impl
;
template
<
class
>
friend
class
data_processor
;
// grant access to private ctor
friend
class
actor
;
friend
class
abstract_actor
;
friend
class
abstract_actor
;
friend
class
down_msg
;
friend
class
exit_msg
;
// allow conversion via actor_cast
// allow conversion via actor_cast
template
<
class
,
class
,
int
>
template
<
class
,
class
,
int
>
...
@@ -62,9 +52,7 @@ public:
...
@@ -62,9 +52,7 @@ public:
// tell actor_cast which semantic this type uses
// tell actor_cast which semantic this type uses
static
constexpr
bool
has_weak_ptr_semantics
=
true
;
static
constexpr
bool
has_weak_ptr_semantics
=
true
;
// tell actor_cast this is a nullable handle type
actor_addr
()
=
default
;
static
constexpr
bool
has_non_null_guarantee
=
true
;
actor_addr
(
actor_addr
&&
)
=
default
;
actor_addr
(
actor_addr
&&
)
=
default
;
actor_addr
(
const
actor_addr
&
)
=
default
;
actor_addr
(
const
actor_addr
&
)
=
default
;
actor_addr
&
operator
=
(
actor_addr
&&
)
=
default
;
actor_addr
&
operator
=
(
actor_addr
&&
)
=
default
;
...
@@ -125,8 +113,6 @@ public:
...
@@ -125,8 +113,6 @@ public:
/// @endcond
/// @endcond
private:
private:
actor_addr
()
=
default
;
inline
actor_control_block
*
get
()
const
noexcept
{
inline
actor_control_block
*
get
()
const
noexcept
{
return
ptr_
.
get
();
return
ptr_
.
get
();
}
}
...
@@ -144,7 +130,6 @@ private:
...
@@ -144,7 +130,6 @@ private:
weak_actor_ptr
ptr_
;
weak_actor_ptr
ptr_
;
};
};
}
// namespace caf
}
// namespace caf
// allow actor_addr to be used in hash maps
// allow actor_addr to be used in hash maps
...
...
libcaf_core/caf/actor_cast.hpp
View file @
9fd915cf
...
@@ -32,10 +32,10 @@ namespace {
...
@@ -32,10 +32,10 @@ namespace {
// The function actor_cast<> computes the type of the cast for
// The function actor_cast<> computes the type of the cast for
// actor_cast_access via the following formula:
// actor_cast_access via the following formula:
// x = 0 if To is a raw poiner
// x = 0 if To is a raw poin
t
er
// = 1 if To is a strong pointer
// = 1 if To is a strong pointer
// = 2 if To is a weak pointer
// = 2 if To is a weak pointer
// y = 0 if From is a raw poiner
// y = 0 if From is a raw poin
t
er
// = 6 if From is a strong pointer
// = 6 if From is a strong pointer
// = 2 if From is a weak pointer
// = 2 if From is a weak pointer
// the result of x * y + z then denotes which operation the cast is performing:
// the result of x * y + z then denotes which operation the cast is performing:
...
@@ -70,22 +70,6 @@ struct is_weak_ptr<T*> : std::false_type {};
...
@@ -70,22 +70,6 @@ struct is_weak_ptr<T*> : std::false_type {};
template
<
class
...
Ts
>
template
<
class
...
Ts
>
struct
is_weak_ptr
<
typed_actor_pointer
<
Ts
...
>>
:
std
::
false_type
{};
struct
is_weak_ptr
<
typed_actor_pointer
<
Ts
...
>>
:
std
::
false_type
{};
template
<
class
T
>
struct
is_non_null_handle
{
static
constexpr
bool
value
=
T
::
has_non_null_guarantee
;
};
template
<
class
T
>
struct
is_non_null_handle
<
T
*>
{
static
constexpr
bool
value
=
false
;
};
template
<
class
T
>
struct
is_strong_non_null_handle
{
static
constexpr
bool
value
=
!
is_weak_ptr
<
T
>::
value
&&
is_non_null_handle
<
T
>::
value
;
};
}
// namespace <anonymous>
}
// namespace <anonymous>
template
<
class
To
,
class
From
,
int
>
template
<
class
To
,
class
From
,
int
>
...
@@ -187,10 +171,6 @@ T actor_cast(U&& what) {
...
@@ -187,10 +171,6 @@ T actor_cast(U&& what) {
// query traits for U
// query traits for U
constexpr
bool
from_raw
=
std
::
is_pointer
<
from_type
>::
value
;
constexpr
bool
from_raw
=
std
::
is_pointer
<
from_type
>::
value
;
constexpr
bool
from_weak
=
is_weak_ptr
<
from_type
>::
value
;
constexpr
bool
from_weak
=
is_weak_ptr
<
from_type
>::
value
;
// check whether this cast is legal
static_assert
(
!
from_weak
||
!
is_strong_non_null_handle
<
T
>::
value
,
"casts from actor_addr to actor or typed_actor are prohibited"
);
// calculate x and y
// calculate x and y
constexpr
int
x
=
to_raw
?
0
:
(
to_weak
?
2
:
1
);
constexpr
int
x
=
to_raw
?
0
:
(
to_weak
?
2
:
1
);
constexpr
int
y
=
from_raw
?
0
:
(
from_weak
?
3
:
6
);
constexpr
int
y
=
from_raw
?
0
:
(
from_weak
?
3
:
6
);
...
...
libcaf_core/caf/actor_factory.hpp
View file @
9fd915cf
...
@@ -183,7 +183,7 @@ template <class T, class... Ts>
...
@@ -183,7 +183,7 @@ template <class T, class... Ts>
actor_factory_result
dyn_spawn_class
(
actor_config
&
cfg
,
message
&
msg
)
{
actor_factory_result
dyn_spawn_class
(
actor_config
&
cfg
,
message
&
msg
)
{
CAF_ASSERT
(
cfg
.
host
);
CAF_ASSERT
(
cfg
.
host
);
using
handle
=
typename
infer_handle_from_class
<
T
>::
type
;
using
handle
=
typename
infer_handle_from_class
<
T
>::
type
;
handle
hdl
{
unsafe_actor_handle_init
}
;
handle
hdl
;
dyn_spawn_class_helper
<
handle
,
T
,
Ts
...
>
factory
{
hdl
,
cfg
};
dyn_spawn_class_helper
<
handle
,
T
,
Ts
...
>
factory
{
hdl
,
cfg
};
msg
.
apply
(
factory
);
msg
.
apply
(
factory
);
return
{
actor_cast
<
strong_actor_ptr
>
(
std
::
move
(
hdl
)),
return
{
actor_cast
<
strong_actor_ptr
>
(
std
::
move
(
hdl
)),
...
...
libcaf_core/caf/function_view.hpp
View file @
9fd915cf
...
@@ -126,11 +126,6 @@ struct function_view_result<typed_actor<Ts...>> {
...
@@ -126,11 +126,6 @@ struct function_view_result<typed_actor<Ts...>> {
typed_actor
<
Ts
...
>
value
{
unsafe_actor_handle_init
};
typed_actor
<
Ts
...
>
value
{
unsafe_actor_handle_init
};
};
};
template
<
>
struct
function_view_result
<
actor
>
{
actor
value
{
unsafe_actor_handle_init
};
};
/// A function view for an actor hides any messaging from the caller.
/// A function view for an actor hides any messaging from the caller.
/// Internally, a function view uses a `scoped_actor` and uses
/// Internally, a function view uses a `scoped_actor` and uses
/// blocking send and receive operations.
/// blocking send and receive operations.
...
...
libcaf_core/caf/fwd.hpp
View file @
9fd915cf
...
@@ -97,8 +97,8 @@ class forwarding_actor_proxy;
...
@@ -97,8 +97,8 @@ class forwarding_actor_proxy;
// -- structs ------------------------------------------------------------------
// -- structs ------------------------------------------------------------------
struct
unit_t
;
struct
unit_t
;
class
exit_msg
;
struct
exit_msg
;
class
down_msg
;
struct
down_msg
;
struct
timeout_msg
;
struct
timeout_msg
;
struct
group_down_msg
;
struct
group_down_msg
;
struct
invalid_actor_t
;
struct
invalid_actor_t
;
...
...
libcaf_core/caf/intrusive_ptr.hpp
View file @
9fd915cf
...
@@ -43,9 +43,6 @@ public:
...
@@ -43,9 +43,6 @@ public:
// tell actor_cast which semantic this type uses
// tell actor_cast which semantic this type uses
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
// tell actor_cast this pointer can be null
static
constexpr
bool
has_non_null_guarantee
=
false
;
constexpr
intrusive_ptr
()
noexcept
:
ptr_
(
nullptr
)
{
constexpr
intrusive_ptr
()
noexcept
:
ptr_
(
nullptr
)
{
// nop
// nop
}
}
...
...
libcaf_core/caf/mixin/requester.hpp
View file @
9fd915cf
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "caf/actor.hpp"
#include "caf/actor.hpp"
#include "caf/message.hpp"
#include "caf/message.hpp"
#include "caf/duration.hpp"
#include "caf/duration.hpp"
#include "caf/message_id.hpp"
#include "caf/response_type.hpp"
#include "caf/response_type.hpp"
#include "caf/response_handle.hpp"
#include "caf/response_handle.hpp"
#include "caf/message_priority.hpp"
#include "caf/message_priority.hpp"
...
@@ -80,11 +81,16 @@ public:
...
@@ -80,11 +81,16 @@ public:
"receiver does not accept given message"
);
"receiver does not accept given message"
);
auto
dptr
=
static_cast
<
Subtype
*>
(
this
);
auto
dptr
=
static_cast
<
Subtype
*>
(
this
);
auto
req_id
=
dptr
->
new_request_id
(
P
);
auto
req_id
=
dptr
->
new_request_id
(
P
);
dest
->
eq_impl
(
req_id
,
dptr
->
ctrl
(),
dptr
->
context
(),
if
(
dest
)
{
std
::
forward
<
Ts
>
(
xs
)...);
dest
->
eq_impl
(
req_id
,
dptr
->
ctrl
(),
dptr
->
context
(),
dptr
->
request_response_timeout
(
timeout
,
req_id
);
std
::
forward
<
Ts
>
(
xs
)...);
dptr
->
request_response_timeout
(
timeout
,
req_id
);
}
else
{
dptr
->
eq_impl
(
req_id
.
response_id
(),
dptr
->
ctrl
(),
dptr
->
context
(),
make_error
(
sec
::
invalid_argument
));
}
return
{
req_id
.
response_id
(),
dptr
};
return
{
req_id
.
response_id
(),
dptr
};
}
}
};
};
}
// namespace mixin
}
// namespace mixin
...
...
libcaf_core/caf/mixin/sender.hpp
View file @
9fd915cf
...
@@ -77,8 +77,9 @@ public:
...
@@ -77,8 +77,9 @@ public:
typename
res_t
::
type
typename
res_t
::
type
>::
valid
,
>::
valid
,
"this actor does not accept the response message"
);
"this actor does not accept the response message"
);
dest
->
eq_impl
(
message_id
::
make
(
P
),
dptr
()
->
ctrl
(),
if
(
dest
)
dptr
()
->
context
(),
std
::
forward
<
Ts
>
(
xs
)...);
dest
->
eq_impl
(
message_id
::
make
(
P
),
dptr
()
->
ctrl
(),
dptr
()
->
context
(),
std
::
forward
<
Ts
>
(
xs
)...);
}
}
template
<
message_priority
P
=
message_priority
::
normal
,
template
<
message_priority
P
=
message_priority
::
normal
,
...
@@ -95,8 +96,9 @@ public:
...
@@ -95,8 +96,9 @@ public:
token
token
>::
valid
,
>::
valid
,
"receiver does not accept given message"
);
"receiver does not accept given message"
);
dest
->
eq_impl
(
message_id
::
make
(
P
),
nullptr
,
if
(
dest
)
dptr
()
->
context
(),
std
::
forward
<
Ts
>
(
xs
)...);
dest
->
eq_impl
(
message_id
::
make
(
P
),
nullptr
,
dptr
()
->
context
(),
std
::
forward
<
Ts
>
(
xs
)...);
}
}
template
<
message_priority
P
=
message_priority
::
normal
,
template
<
message_priority
P
=
message_priority
::
normal
,
...
@@ -135,9 +137,10 @@ public:
...
@@ -135,9 +137,10 @@ public:
>::
type
>::
type
>::
valid
,
>::
valid
,
"this actor does not accept the response message"
);
"this actor does not accept the response message"
);
dptr
()
->
system
().
scheduler
().
delayed_send
(
if
(
dest
)
rtime
,
dptr
()
->
ctrl
(),
actor_cast
<
strong_actor_ptr
>
(
dest
),
dptr
()
->
system
().
scheduler
().
delayed_send
(
message_id
::
make
(
P
),
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
rtime
,
dptr
()
->
ctrl
(),
actor_cast
<
strong_actor_ptr
>
(
dest
),
message_id
::
make
(
P
),
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
}
}
template
<
message_priority
P
=
message_priority
::
normal
,
template
<
message_priority
P
=
message_priority
::
normal
,
...
@@ -154,9 +157,10 @@ public:
...
@@ -154,9 +157,10 @@ public:
token
token
>::
valid
,
>::
valid
,
"receiver does not accept given message"
);
"receiver does not accept given message"
);
dptr
()
->
system
().
scheduler
().
delayed_send
(
if
(
dest
)
rtime
,
nullptr
,
actor_cast
<
strong_actor_ptr
>
(
dest
),
dptr
()
->
system
().
scheduler
().
delayed_send
(
message_id
::
make
(
P
),
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
rtime
,
nullptr
,
actor_cast
<
strong_actor_ptr
>
(
dest
),
message_id
::
make
(
P
),
make_message
(
std
::
forward
<
Ts
>
(
xs
)...));
}
}
private:
private:
...
...
libcaf_core/caf/scoped_actor.hpp
View file @
9fd915cf
...
@@ -42,9 +42,6 @@ public:
...
@@ -42,9 +42,6 @@ public:
// tell actor_cast which semantic this type uses
// tell actor_cast which semantic this type uses
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
// tell actor_cast this is a non-null handle type
static
constexpr
bool
has_non_null_guarantee
=
true
;
scoped_actor
(
actor_system
&
sys
,
bool
hide_actor
=
false
);
scoped_actor
(
actor_system
&
sys
,
bool
hide_actor
=
false
);
scoped_actor
(
const
scoped_actor
&
)
=
delete
;
scoped_actor
(
const
scoped_actor
&
)
=
delete
;
...
@@ -55,6 +52,10 @@ public:
...
@@ -55,6 +52,10 @@ public:
~
scoped_actor
();
~
scoped_actor
();
inline
explicit
operator
bool
()
const
{
return
static_cast
<
bool
>
(
self_
);
}
inline
actor_system
&
home_system
()
const
{
inline
actor_system
&
home_system
()
const
{
return
*
self_
->
home_system
;
return
*
self_
->
home_system
;
}
}
...
...
libcaf_core/caf/send.hpp
View file @
9fd915cf
...
@@ -62,8 +62,9 @@ void send_as(const Source& src, const Dest& dest, Ts&&... xs) {
...
@@ -62,8 +62,9 @@ void send_as(const Source& src, const Dest& dest, Ts&&... xs) {
token
>
token
>
>::
valid
,
>::
valid
,
"this actor does not accept the response message"
);
"this actor does not accept the response message"
);
dest
->
eq_impl
(
message_id
::
make
(
P
),
actor_cast
<
strong_actor_ptr
>
(
src
),
if
(
dest
)
nullptr
,
std
::
forward
<
Ts
>
(
xs
)...);
dest
->
eq_impl
(
message_id
::
make
(
P
),
actor_cast
<
strong_actor_ptr
>
(
src
),
nullptr
,
std
::
forward
<
Ts
>
(
xs
)...);
}
}
/// Anonymously sends `dest` a message.
/// Anonymously sends `dest` a message.
...
@@ -74,14 +75,17 @@ void anon_send(const Dest& dest, Ts&&... xs) {
...
@@ -74,14 +75,17 @@ void anon_send(const Dest& dest, Ts&&... xs) {
using
token
=
detail
::
type_list
<
detail
::
strip_and_convert_t
<
Ts
>
...
>
;
using
token
=
detail
::
type_list
<
detail
::
strip_and_convert_t
<
Ts
>
...
>
;
static_assert
(
response_type_unbox
<
signatures_of_t
<
Dest
>
,
token
>::
valid
,
static_assert
(
response_type_unbox
<
signatures_of_t
<
Dest
>
,
token
>::
valid
,
"receiver does not accept given message"
);
"receiver does not accept given message"
);
dest
->
eq_impl
(
message_id
::
make
(
P
),
nullptr
,
nullptr
,
std
::
forward
<
Ts
>
(
xs
)...);
if
(
dest
)
dest
->
eq_impl
(
message_id
::
make
(
P
),
nullptr
,
nullptr
,
std
::
forward
<
Ts
>
(
xs
)...);
}
}
/// Anonymously sends `dest` an exit message.
/// Anonymously sends `dest` an exit message.
template
<
class
Dest
>
template
<
class
Dest
>
void
anon_send_exit
(
const
Dest
&
dest
,
exit_reason
reason
)
{
void
anon_send_exit
(
const
Dest
&
dest
,
exit_reason
reason
)
{
dest
->
enqueue
(
nullptr
,
message_id
::
make
(),
if
(
dest
)
make_message
(
exit_msg
{
dest
->
address
(),
reason
}),
nullptr
);
dest
->
enqueue
(
nullptr
,
message_id
::
make
(),
make_message
(
exit_msg
{
dest
->
address
(),
reason
}),
nullptr
);
}
}
/// Anonymously sends `to` an exit message.
/// Anonymously sends `to` an exit message.
...
...
libcaf_core/caf/system_messages.hpp
View file @
9fd915cf
...
@@ -39,34 +39,12 @@ namespace caf {
...
@@ -39,34 +39,12 @@ namespace caf {
/// Sent to all links when an actor is terminated.
/// Sent to all links when an actor is terminated.
/// @note Actors can override the default handler by calling
/// @note Actors can override the default handler by calling
/// `self->set_exit_handler(...)`.
/// `self->set_exit_handler(...)`.
class
exit_msg
{
struct
exit_msg
{
public:
// -- friend types that need access to private ctors -------------------------
template
<
class
>
friend
class
data_processor
;
template
<
class
>
friend
class
detail
::
type_erased_value_impl
;
// -- constructors -----------------------------------------------------------
inline
exit_msg
(
actor_addr
x
,
error
y
)
:
source
(
std
::
move
(
x
)),
reason
(
std
::
move
(
y
))
{
// nop
}
// -- data members -----------------------------------------------------------
/// The source of this message, i.e., the terminated actor.
/// The source of this message, i.e., the terminated actor.
actor_addr
source
;
actor_addr
source
;
/// The exit reason of the terminated actor.
/// The exit reason of the terminated actor.
error
reason
;
error
reason
;
private:
exit_msg
()
=
default
;
};
};
/// @relates exit_msg
/// @relates exit_msg
...
@@ -76,34 +54,12 @@ typename Inspector::result_type inspect(Inspector& f, exit_msg& x) {
...
@@ -76,34 +54,12 @@ typename Inspector::result_type inspect(Inspector& f, exit_msg& x) {
}
}
/// Sent to all actors monitoring an actor when it is terminated.
/// Sent to all actors monitoring an actor when it is terminated.
class
down_msg
{
struct
down_msg
{
public:
// -- friend types that need access to private ctors -------------------------
template
<
class
>
friend
class
data_processor
;
template
<
class
>
friend
class
detail
::
type_erased_value_impl
;
// -- constructors -----------------------------------------------------------
inline
down_msg
(
actor_addr
x
,
error
y
)
:
source
(
std
::
move
(
x
)),
reason
(
std
::
move
(
y
))
{
// nop
}
// -- data members -----------------------------------------------------------
/// The source of this message, i.e., the terminated actor.
/// The source of this message, i.e., the terminated actor.
actor_addr
source
;
actor_addr
source
;
/// The exit reason of the terminated actor.
/// The exit reason of the terminated actor.
error
reason
;
error
reason
;
private:
down_msg
()
=
default
;
};
};
/// @relates down_msg
/// @relates down_msg
...
...
libcaf_core/caf/typed_actor.hpp
View file @
9fd915cf
...
@@ -78,9 +78,6 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
...
@@ -78,9 +78,6 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
// tell actor_cast which semantic this type uses
// tell actor_cast which semantic this type uses
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
static
constexpr
bool
has_weak_ptr_semantics
=
false
;
// tell actor_cast this is a non-null handle type
static
constexpr
bool
has_non_null_guarantee
=
true
;
/// Creates a new `typed_actor` type by extending this one with `Es...`.
/// Creates a new `typed_actor` type by extending this one with `Es...`.
template
<
class
...
Es
>
template
<
class
...
Es
>
using
extend
=
typed_actor
<
Sigs
...,
Es
...
>
;
using
extend
=
typed_actor
<
Sigs
...,
Es
...
>
;
...
@@ -172,6 +169,11 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
...
@@ -172,6 +169,11 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
// nop
// nop
}
}
/// Queries whether this actor handle is valid.
inline
explicit
operator
bool
()
const
{
return
static_cast
<
bool
>
(
ptr_
);
}
/// Queries the address of the stored actor.
/// Queries the address of the stored actor.
actor_addr
address
()
const
noexcept
{
actor_addr
address
()
const
noexcept
{
return
{
ptr_
.
get
(),
true
};
return
{
ptr_
.
get
(),
true
};
...
...
libcaf_core/caf/typed_actor_pointer.hpp
View file @
9fd915cf
...
@@ -50,6 +50,10 @@ public:
...
@@ -50,6 +50,10 @@ public:
return
&
view_
;
return
&
view_
;
}
}
inline
explicit
operator
bool
()
const
{
return
static_cast
<
bool
>
(
view_
.
internal_ptr
());
}
/// @private
/// @private
actor_control_block
*
get
()
const
{
actor_control_block
*
get
()
const
{
return
view_
.
ctrl
();
return
view_
.
ctrl
();
...
...
libcaf_core/caf/weak_intrusive_ptr.hpp
View file @
9fd915cf
...
@@ -47,9 +47,6 @@ public:
...
@@ -47,9 +47,6 @@ public:
// tell actor_cast which semantic this type uses
// tell actor_cast which semantic this type uses
static
constexpr
bool
has_weak_ptr_semantics
=
true
;
static
constexpr
bool
has_weak_ptr_semantics
=
true
;
// tell actor_cast this pointer can be null
static
constexpr
bool
has_non_null_guarantee
=
false
;
constexpr
weak_intrusive_ptr
()
noexcept
:
ptr_
(
nullptr
)
{
constexpr
weak_intrusive_ptr
()
noexcept
:
ptr_
(
nullptr
)
{
// nop
// nop
}
}
...
...
libcaf_core/src/actor.cpp
View file @
9fd915cf
...
@@ -61,7 +61,7 @@ intptr_t actor::compare(const actor& x) const noexcept {
...
@@ -61,7 +61,7 @@ intptr_t actor::compare(const actor& x) const noexcept {
}
}
intptr_t
actor
::
compare
(
const
actor_addr
&
x
)
const
noexcept
{
intptr_t
actor
::
compare
(
const
actor_addr
&
x
)
const
noexcept
{
return
actor_addr
::
compare
(
ptr_
.
get
(),
x
.
ptr_
.
get
(
));
return
actor_addr
::
compare
(
ptr_
.
get
(),
actor_cast
<
actor_control_block
*>
(
x
));
}
}
intptr_t
actor
::
compare
(
const
strong_actor_ptr
&
x
)
const
noexcept
{
intptr_t
actor
::
compare
(
const
strong_actor_ptr
&
x
)
const
noexcept
{
...
...
libcaf_core/test/actor_termination.cpp
View file @
9fd915cf
...
@@ -46,8 +46,7 @@ struct fixture {
...
@@ -46,8 +46,7 @@ struct fixture {
fixture
()
fixture
()
:
system
(
cfg
),
:
system
(
cfg
),
scoped_self
(
system
),
scoped_self
(
system
),
mirror
(
system
.
spawn
(
mirror_impl
)),
mirror
(
system
.
spawn
(
mirror_impl
))
{
testee
(
unsafe_actor_handle_init
)
{
// nop
// nop
}
}
...
...
libcaf_core/test/parse_ini.cpp
View file @
9fd915cf
...
@@ -101,7 +101,7 @@ struct fixture {
...
@@ -101,7 +101,7 @@ struct fixture {
actor_system_config
cfg
;
actor_system_config
cfg
;
actor_system
system
;
actor_system
system
;
fixture
()
:
system
(
cfg
)
,
config_server
(
unsafe_actor_handle_init
)
{
fixture
()
:
system
(
cfg
)
{
// nop
// nop
}
}
...
...
libcaf_core/test/splitter.cpp
View file @
9fd915cf
...
@@ -68,12 +68,7 @@ struct fixture {
...
@@ -68,12 +68,7 @@ struct fixture {
actor
second
;
actor
second
;
actor
first_and_second
;
actor
first_and_second
;
fixture
()
fixture
()
:
system
(
cfg
),
self
(
system
,
true
)
{
:
system
(
cfg
),
self
(
system
,
true
),
first
(
unsafe_actor_handle_init
),
second
(
unsafe_actor_handle_init
),
first_and_second
(
unsafe_actor_handle_init
)
{
// nop
// nop
}
}
...
...
libcaf_io/test/basp.cpp
View file @
9fd915cf
...
@@ -579,7 +579,7 @@ CAF_TEST(remote_actor_and_send) {
...
@@ -579,7 +579,7 @@ CAF_TEST(remote_actor_and_send) {
mpx
()
->
provide_scribe
(
lo
,
4242
,
jupiter
().
connection
);
mpx
()
->
provide_scribe
(
lo
,
4242
,
jupiter
().
connection
);
CAF_REQUIRE
(
mpx
()
->
has_pending_scribe
(
lo
,
4242
));
CAF_REQUIRE
(
mpx
()
->
has_pending_scribe
(
lo
,
4242
));
auto
mm1
=
system
.
middleman
().
actor_handle
();
auto
mm1
=
system
.
middleman
().
actor_handle
();
actor
result
{
unsafe_actor_handle_init
}
;
actor
result
;
auto
f
=
self
()
->
request
(
mm1
,
infinite
,
auto
f
=
self
()
->
request
(
mm1
,
infinite
,
connect_atom
::
value
,
lo
,
uint16_t
{
4242
});
connect_atom
::
value
,
lo
,
uint16_t
{
4242
});
// wait until BASP broker has received and processed the connect message
// wait until BASP broker has received and processed the connect message
...
...
libcaf_io/test/http_broker.cpp
View file @
9fd915cf
...
@@ -171,8 +171,7 @@ behavior server(broker* self) {
...
@@ -171,8 +171,7 @@ behavior server(broker* self) {
class
fixture
{
class
fixture
{
public:
public:
fixture
()
:
system
(
cfg
.
load
<
io
::
middleman
,
network
::
test_multiplexer
>
()),
fixture
()
:
system
(
cfg
.
load
<
io
::
middleman
,
network
::
test_multiplexer
>
())
{
aut_
(
unsafe_actor_handle_init
)
{
mpx_
=
dynamic_cast
<
network
::
test_multiplexer
*>
(
&
system
.
middleman
().
backend
());
mpx_
=
dynamic_cast
<
network
::
test_multiplexer
*>
(
&
system
.
middleman
().
backend
());
CAF_REQUIRE
(
mpx_
!=
nullptr
);
CAF_REQUIRE
(
mpx_
!=
nullptr
);
// spawn the actor-under-test
// spawn the actor-under-test
...
...
libcaf_io/test/unpublish.cpp
View file @
9fd915cf
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
};
};
struct
fixture
{
struct
fixture
{
fixture
()
:
testee
(
unsafe_actor_handle_init
)
{
fixture
()
{
new
(
&
system
)
actor_system
(
cfg
.
load
<
io
::
middleman
>
()
new
(
&
system
)
actor_system
(
cfg
.
load
<
io
::
middleman
>
()
.
parse
(
test
::
engine
::
argc
(),
.
parse
(
test
::
engine
::
argc
(),
test
::
engine
::
argv
()));
test
::
engine
::
argv
()));
...
@@ -71,7 +71,7 @@ struct fixture {
...
@@ -71,7 +71,7 @@ struct fixture {
actor
remote_actor
(
const
char
*
hostname
,
uint16_t
port
,
actor
remote_actor
(
const
char
*
hostname
,
uint16_t
port
,
bool
expect_fail
=
false
)
{
bool
expect_fail
=
false
)
{
actor
result
{
unsafe_actor_handle_init
}
;
actor
result
;
scoped_actor
self
{
system
,
true
};
scoped_actor
self
{
system
,
true
};
self
->
request
(
system
.
middleman
().
actor_handle
(),
infinite
,
self
->
request
(
system
.
middleman
().
actor_handle
(),
infinite
,
connect_atom
::
value
,
hostname
,
port
).
receive
(
connect_atom
::
value
,
hostname
,
port
).
receive
(
...
...
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