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
66d9e98c
Commit
66d9e98c
authored
Sep 16, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate .unsafe functions, close #507
parent
98e3e2b3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
32 deletions
+37
-32
libcaf_core/caf/actor.hpp
libcaf_core/caf/actor.hpp
+6
-1
libcaf_core/caf/function_view.hpp
libcaf_core/caf/function_view.hpp
+4
-4
libcaf_core/caf/monitorable_actor.hpp
libcaf_core/caf/monitorable_actor.hpp
+8
-12
libcaf_core/caf/typed_actor.hpp
libcaf_core/caf/typed_actor.hpp
+5
-0
libcaf_core/src/forwarding_actor_proxy.cpp
libcaf_core/src/forwarding_actor_proxy.cpp
+2
-2
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+6
-7
libcaf_core/test/parse_ini.cpp
libcaf_core/test/parse_ini.cpp
+2
-2
libcaf_core/test/splitter.cpp
libcaf_core/test/splitter.cpp
+1
-1
libcaf_io/test/unpublish.cpp
libcaf_io/test/unpublish.cpp
+3
-3
No files found.
libcaf_core/caf/actor.hpp
View file @
66d9e98c
...
...
@@ -115,6 +115,11 @@ public:
return
static_cast
<
bool
>
(
ptr_
);
}
/// Queries whether this actor handle is invalid.
inline
bool
operator
!
()
const
{
return
!
ptr_
;
}
/// Returns the address of the stored actor.
actor_addr
address
()
const
noexcept
;
...
...
@@ -138,7 +143,7 @@ public:
/// Queries whether this object was constructed using
/// `unsafe_actor_handle_init` or is in moved-from state.
bool
unsafe
()
const
{
bool
unsafe
()
const
CAF_DEPRECATED
{
return
!
ptr_
;
}
...
...
libcaf_core/caf/function_view.hpp
View file @
66d9e98c
...
...
@@ -148,14 +148,14 @@ public:
}
~
function_view
()
{
if
(
!
impl_
.
unsafe
()
)
if
(
impl_
)
self_
.
~
scoped_actor
();
}
function_view
(
function_view
&&
x
)
:
timeout
(
x
.
timeout
),
impl_
(
std
::
move
(
x
.
impl_
))
{
if
(
!
impl_
.
unsafe
()
)
{
if
(
impl_
)
{
new
(
&
self_
)
scoped_actor
(
impl_
.
home_system
());
//(std::move(x.self_));
x
.
self_
.
~
scoped_actor
();
}
...
...
@@ -179,7 +179,7 @@ public:
>
...
>::
tuple_type
>>
expected
<
R
>
operator
()(
Ts
&&
...
xs
)
{
if
(
impl_
.
unsafe
()
)
if
(
!
impl_
)
return
sec
::
bad_function_call
;
error
err
;
function_view_result
<
R
>
result
;
...
...
@@ -221,7 +221,7 @@ private:
}
void
new_self
(
const
Actor
&
x
)
{
if
(
!
x
.
unsafe
()
)
if
(
x
)
new
(
&
self_
)
scoped_actor
(
x
->
home_system
());
}
...
...
libcaf_core/caf/monitorable_actor.hpp
View file @
66d9e98c
...
...
@@ -58,35 +58,31 @@ public:
/// Links this actor to `x`.
void
link_to
(
const
actor_addr
&
x
)
{
auto
ptr
=
actor_cast
<
strong_actor_ptr
>
(
x
);
if
(
!
ptr
||
ptr
->
get
()
==
this
)
return
;
link_impl
(
establish_link_op
,
ptr
->
get
());
if
(
ptr
&&
ptr
->
get
()
!=
this
)
link_impl
(
establish_link_op
,
ptr
->
get
());
}
/// Links this actor to `x`.
template
<
class
ActorHandle
>
void
link_to
(
const
ActorHandle
&
x
)
{
auto
ptr
=
actor_cast
<
abstract_actor
*>
(
x
);
if
(
!
ptr
||
ptr
==
this
)
return
;
link_impl
(
establish_link_op
,
ptr
);
if
(
ptr
&&
ptr
!=
this
)
link_impl
(
establish_link_op
,
ptr
);
}
/// Unlinks this actor from `x`.
void
unlink_from
(
const
actor_addr
&
x
)
{
auto
ptr
=
actor_cast
<
strong_actor_ptr
>
(
x
);
if
(
!
ptr
||
ptr
->
get
()
==
this
)
return
;
link_impl
(
remove_link_op
,
ptr
->
get
());
if
(
ptr
&&
ptr
->
get
()
!=
this
)
link_impl
(
remove_link_op
,
ptr
->
get
());
}
/// Links this actor to `x`.
template
<
class
ActorHandle
>
void
unlink_from
(
const
ActorHandle
&
x
)
{
auto
ptr
=
actor_cast
<
abstract_actor
*>
(
x
);
if
(
!
ptr
||
ptr
==
this
)
return
;
link_impl
(
remove_link_op
,
ptr
);
if
(
ptr
&&
ptr
!=
this
)
link_impl
(
remove_link_op
,
ptr
);
}
/// @cond PRIVATE
...
...
libcaf_core/caf/typed_actor.hpp
View file @
66d9e98c
...
...
@@ -174,6 +174,11 @@ class typed_actor : detail::comparable<typed_actor<Sigs...>>,
return
static_cast
<
bool
>
(
ptr_
);
}
/// Queries whether this actor handle is invalid.
inline
bool
operator
!
()
const
{
return
!
ptr_
;
}
/// Queries the address of the stored actor.
actor_addr
address
()
const
noexcept
{
return
{
ptr_
.
get
(),
true
};
...
...
libcaf_core/src/forwarding_actor_proxy.cpp
View file @
66d9e98c
...
...
@@ -33,7 +33,7 @@ forwarding_actor_proxy::forwarding_actor_proxy(actor_config& cfg, actor mgr)
}
forwarding_actor_proxy
::~
forwarding_actor_proxy
()
{
if
(
!
manager_
.
unsafe
()
)
if
(
manager_
)
anon_send
(
manager_
,
make_message
(
delete_atom
::
value
,
node
(),
id
()));
}
...
...
@@ -54,7 +54,7 @@ void forwarding_actor_proxy::forward_msg(strong_actor_ptr sender,
<<
CAF_ARG
(
mid
)
<<
CAF_ARG
(
msg
));
forwarding_stack
tmp
;
shared_lock
<
detail
::
shared_spinlock
>
guard_
(
manager_mtx_
);
if
(
!
manager_
.
unsafe
()
)
if
(
manager_
)
manager_
->
enqueue
(
nullptr
,
invalid_message_id
,
make_message
(
forward_atom
::
value
,
std
::
move
(
sender
),
fwd
?
*
fwd
:
tmp
,
...
...
libcaf_core/src/local_actor.cpp
View file @
66d9e98c
...
...
@@ -75,18 +75,17 @@ void local_actor::request_response_timeout(const duration& d, message_id mid) {
}
void
local_actor
::
monitor
(
abstract_actor
*
ptr
)
{
if
(
!
ptr
)
return
;
ptr
->
attach
(
default_attachable
::
make_monitor
(
ptr
->
address
(),
address
()));
if
(
ptr
)
ptr
->
attach
(
default_attachable
::
make_monitor
(
ptr
->
address
(),
address
()));
}
void
local_actor
::
demonitor
(
const
actor_addr
&
whom
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
whom
));
auto
ptr
=
actor_cast
<
strong_actor_ptr
>
(
whom
);
if
(
!
ptr
)
return
;
default_attachable
::
observe_token
tk
{
address
(),
default_attachable
::
monitor
}
;
ptr
->
get
()
->
detach
(
tk
);
if
(
ptr
)
{
default_attachable
::
observe_token
tk
{
address
(),
default_attachable
::
monitor
}
;
ptr
->
get
()
->
detach
(
tk
)
;
}
}
void
local_actor
::
on_exit
()
{
...
...
libcaf_core/test/parse_ini.cpp
View file @
66d9e98c
...
...
@@ -174,7 +174,7 @@ struct fixture {
template
<
class
T
>
bool
value_is
(
const
char
*
key
,
const
T
&
what
)
{
if
(
!
config_server
.
unsafe
()
)
if
(
config_server
)
return
config_server_has
(
key
,
what
);
auto
&
cv
=
values
[
key
];
using
type
=
...
...
@@ -192,7 +192,7 @@ struct fixture {
}
size_t
num_values
()
{
if
(
!
config_server
.
unsafe
()
)
{
if
(
config_server
)
{
size_t
result
=
0
;
scoped_actor
self
{
system
};
self
->
request
(
config_server
,
infinite
,
get_atom
::
value
,
"*"
).
receive
(
...
...
libcaf_core/test/splitter.cpp
View file @
66d9e98c
...
...
@@ -47,7 +47,7 @@ second_stage::behavior_type typed_second_stage() {
return
x
*
y
;
},
[](
double
x
)
{
return
23.0
f
*
x
;
return
23.0
*
x
;
}
};
}
...
...
libcaf_io/test/unpublish.cpp
View file @
66d9e98c
...
...
@@ -85,9 +85,9 @@ struct fixture {
}
);
if
(
expect_fail
)
CAF_REQUIRE
(
result
.
unsafe
()
);
CAF_REQUIRE
(
!
result
);
else
CAF_REQUIRE
(
!
result
.
unsafe
()
);
CAF_REQUIRE
(
result
);
return
result
;
}
...
...
@@ -121,7 +121,7 @@ CAF_TEST(unpublishing) {
down_msg
{
testee
.
address
(),
exit_reason
::
normal
});
// must fail now
auto
x2
=
remote_actor
(
"127.0.0.1"
,
port
,
true
);
CAF_CHECK
(
x2
.
unsafe
()
);
CAF_CHECK
(
!
x2
);
}
CAF_TEST_FIXTURE_SCOPE_END
()
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