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
a2660f28
Commit
a2660f28
authored
Jan 09, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting
parent
00ddd026
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
166 deletions
+92
-166
libcaf_core/test/actor_lifetime.cpp
libcaf_core/test/actor_lifetime.cpp
+4
-8
libcaf_core/test/actor_pool.cpp
libcaf_core/test/actor_pool.cpp
+2
-2
libcaf_core/test/dynamic_spawn.cpp
libcaf_core/test/dynamic_spawn.cpp
+86
-156
No files found.
libcaf_core/test/actor_lifetime.cpp
View file @
a2660f28
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
#define CAF_SUITE actor_lifetime
#define CAF_SUITE actor_lifetime
#include "caf/test/unit_test.hpp"
#include "caf/test/unit_test.hpp"
#include <mutex>
#include <atomic>
#include <atomic>
#include <condition_variable>
#include <condition_variable>
#include <mutex>
#include "caf/all.hpp"
#include "caf/all.hpp"
...
@@ -62,9 +62,7 @@ public:
...
@@ -62,9 +62,7 @@ public:
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
return
{
return
{
[
=
](
int
x
)
{
[
=
](
int
x
)
{
return
x
;
},
return
x
;
}
};
};
}
}
};
};
...
@@ -108,12 +106,10 @@ behavior tester(event_based_actor* self, const actor& aut) {
...
@@ -108,12 +106,10 @@ behavior tester(event_based_actor* self, const actor& aut) {
CAF_CHECK_EQUAL
(
s_testees
.
load
(),
0
);
CAF_CHECK_EQUAL
(
s_testees
.
load
(),
0
);
CAF_CHECK_EQUAL
(
s_pending_on_exits
.
load
(),
0
);
CAF_CHECK_EQUAL
(
s_pending_on_exits
.
load
(),
0
);
self
->
quit
();
self
->
quit
();
}
}
,
};
};
}
}
struct
config
:
actor_system_config
{
struct
config
:
actor_system_config
{
config
()
{
config
()
{
set
(
"scheduler.policy"
,
"testing"
);
set
(
"scheduler.policy"
,
"testing"
);
...
@@ -163,7 +159,7 @@ struct fixture {
...
@@ -163,7 +159,7 @@ struct fixture {
}
}
// Run the exit_msg.
// Run the exit_msg.
sched
.
run_once
();
sched
.
run_once
();
//expect((exit_msg), from(tst_driver).to(tst_subject));
//
expect((exit_msg), from(tst_driver).to(tst_subject));
{
// Resume driver.
{
// Resume driver.
std
::
unique_lock
<
std
::
mutex
>
guard
{
s_mtx
};
std
::
unique_lock
<
std
::
mutex
>
guard
{
s_mtx
};
s_testee_cleanup_done
=
true
;
s_testee_cleanup_done
=
true
;
...
...
libcaf_core/test/actor_pool.cpp
View file @
a2660f28
...
@@ -86,8 +86,8 @@ CAF_TEST_FIXTURE_SCOPE(actor_pool_tests, fixture)
...
@@ -86,8 +86,8 @@ CAF_TEST_FIXTURE_SCOPE(actor_pool_tests, fixture)
CAF_TEST
(
round_robin_actor_pool
)
{
CAF_TEST
(
round_robin_actor_pool
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
auto
pool
auto
pool
=
actor_pool
::
make
(
&
context
,
5
,
spawn_worker
,
=
actor_pool
::
make
(
&
context
,
5
,
spawn_worker
,
actor_pool
::
round_robin
());
actor_pool
::
round_robin
());
self
->
send
(
pool
,
sys_atom_v
,
put_atom_v
,
spawn_worker
());
self
->
send
(
pool
,
sys_atom_v
,
put_atom_v
,
spawn_worker
());
std
::
vector
<
actor
>
workers
;
std
::
vector
<
actor
>
workers
;
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
...
...
libcaf_core/test/dynamic_spawn.cpp
View file @
a2660f28
...
@@ -57,30 +57,12 @@ class event_testee : public event_based_actor {
...
@@ -57,30 +57,12 @@ class event_testee : public event_based_actor {
public:
public:
event_testee
(
actor_config
&
cfg
)
:
event_based_actor
(
cfg
)
{
event_testee
(
actor_config
&
cfg
)
:
event_based_actor
(
cfg
)
{
inc_actor_instances
();
inc_actor_instances
();
wait4string
.
assign
(
wait4string
.
assign
([
=
](
const
std
::
string
&
)
{
become
(
wait4int
);
},
[
=
](
const
std
::
string
&
)
{
[
=
](
get_atom
)
{
return
"wait4string"
;
});
become
(
wait4int
);
wait4float
.
assign
([
=
](
float
)
{
become
(
wait4string
);
},
},
[
=
](
get_atom
)
{
return
"wait4float"
;
});
[
=
](
get_atom
)
{
wait4int
.
assign
([
=
](
int
)
{
become
(
wait4float
);
},
return
"wait4string"
;
[
=
](
get_atom
)
{
return
"wait4int"
;
});
}
);
wait4float
.
assign
(
[
=
](
float
)
{
become
(
wait4string
);
},
[
=
](
get_atom
)
{
return
"wait4float"
;
}
);
wait4int
.
assign
(
[
=
](
int
)
{
become
(
wait4float
);
},
[
=
](
get_atom
)
{
return
"wait4int"
;
}
);
}
}
~
event_testee
()
override
{
~
event_testee
()
override
{
...
@@ -101,8 +83,7 @@ actor spawn_event_testee2(scoped_actor& parent) {
...
@@ -101,8 +83,7 @@ actor spawn_event_testee2(scoped_actor& parent) {
struct
wrapper
:
event_based_actor
{
struct
wrapper
:
event_based_actor
{
actor
parent
;
actor
parent
;
wrapper
(
actor_config
&
cfg
,
actor
parent_actor
)
wrapper
(
actor_config
&
cfg
,
actor
parent_actor
)
:
event_based_actor
(
cfg
),
:
event_based_actor
(
cfg
),
parent
(
std
::
move
(
parent_actor
))
{
parent
(
std
::
move
(
parent_actor
))
{
inc_actor_instances
();
inc_actor_instances
();
}
}
~
wrapper
()
override
{
~
wrapper
()
override
{
...
@@ -110,14 +91,15 @@ actor spawn_event_testee2(scoped_actor& parent) {
...
@@ -110,14 +91,15 @@ actor spawn_event_testee2(scoped_actor& parent) {
}
}
behavior
wait4timeout
(
int
remaining
)
{
behavior
wait4timeout
(
int
remaining
)
{
return
{
return
{
after
(
chrono
::
milliseconds
(
1
))
>>
[
=
]
{
after
(
chrono
::
milliseconds
(
1
))
>>
CAF_MESSAGE
(
"remaining: "
<<
to_string
(
remaining
));
[
=
]
{
if
(
remaining
==
1
)
{
CAF_MESSAGE
(
"remaining: "
<<
to_string
(
remaining
));
send
(
parent
,
ok_atom_v
);
if
(
remaining
==
1
)
{
quit
();
send
(
parent
,
ok_atom_v
);
}
quit
();
else
become
(
wait4timeout
(
remaining
-
1
));
}
else
}
become
(
wait4timeout
(
remaining
-
1
));
},
};
};
}
}
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
...
@@ -139,47 +121,29 @@ public:
...
@@ -139,47 +121,29 @@ public:
void
act
()
override
{
void
act
()
override
{
bool
running
=
true
;
bool
running
=
true
;
receive_while
(
running
)
(
receive_while
(
running
)([
&
](
int
)
{
wait4float
();
},
[
&
](
int
)
{
[
&
](
get_atom
)
{
return
"wait4int"
;
},
wait4float
();
[
&
](
exit_msg
&
em
)
{
},
if
(
em
.
reason
)
{
[
&
](
get_atom
)
{
fail_state
(
std
::
move
(
em
.
reason
));
return
"wait4int"
;
running
=
false
;
},
}
[
&
](
exit_msg
&
em
)
{
});
if
(
em
.
reason
)
{
fail_state
(
std
::
move
(
em
.
reason
));
running
=
false
;
}
}
);
}
}
private:
private:
void
wait4string
()
{
void
wait4string
()
{
bool
string_received
=
false
;
bool
string_received
=
false
;
do_receive
(
do_receive
([
&
](
const
string
&
)
{
string_received
=
true
;
},
[
&
](
const
string
&
)
{
[
&
](
get_atom
)
{
return
"wait4string"
;
})
string_received
=
true
;
.
until
([
&
]
{
return
string_received
;
});
},
[
&
](
get_atom
)
{
return
"wait4string"
;
}
)
.
until
([
&
]
{
return
string_received
;
});
}
}
void
wait4float
()
{
void
wait4float
()
{
bool
float_received
=
false
;
bool
float_received
=
false
;
do_receive
(
do_receive
([
&
](
float
)
{
float_received
=
true
;
},
[
&
](
float
)
{
[
&
](
get_atom
)
{
return
"wait4float"
;
})
float_received
=
true
;
.
until
([
&
]
{
return
float_received
;
});
},
[
&
](
get_atom
)
{
return
"wait4float"
;
}
)
.
until
([
&
]
{
return
float_received
;
});
wait4string
();
wait4string
();
}
}
};
};
...
@@ -197,9 +161,7 @@ public:
...
@@ -197,9 +161,7 @@ public:
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
return
{
return
{
after
(
chrono
::
milliseconds
(
10
))
>>
[
=
]
{
after
(
chrono
::
milliseconds
(
10
))
>>
[
=
]
{
unbecome
();
},
unbecome
();
}
};
};
}
}
};
};
...
@@ -219,7 +181,7 @@ public:
...
@@ -219,7 +181,7 @@ public:
return
{
return
{
[]
{
[]
{
// nop
// nop
}
}
,
};
};
}
}
};
};
...
@@ -239,18 +201,18 @@ public:
...
@@ -239,18 +201,18 @@ public:
return
{
return
{
[]
{
[]
{
// nop
// nop
}
}
,
};
};
}
}
};
};
behavior
master
(
event_based_actor
*
self
)
{
behavior
master
(
event_based_actor
*
self
)
{
return
(
return
{
[
=
](
ok_atom
)
{
[
=
](
ok_atom
)
{
CAF_MESSAGE
(
"master: received done"
);
CAF_MESSAGE
(
"master: received done"
);
self
->
quit
(
exit_reason
::
user_shutdown
);
self
->
quit
(
exit_reason
::
user_shutdown
);
}
}
,
)
;
}
;
}
}
behavior
slave
(
event_based_actor
*
self
,
const
actor
&
master
)
{
behavior
slave
(
event_based_actor
*
self
,
const
actor
&
master
)
{
...
@@ -262,7 +224,7 @@ behavior slave(event_based_actor* self, const actor& master) {
...
@@ -262,7 +224,7 @@ behavior slave(event_based_actor* self, const actor& master) {
return
{
return
{
[]
{
[]
{
// nop
// nop
}
}
,
};
};
}
}
...
@@ -292,7 +254,9 @@ public:
...
@@ -292,7 +254,9 @@ public:
struct
fixture
{
struct
fixture
{
actor_system_config
cfg
;
actor_system_config
cfg
;
// put inside a union to control ctor/dtor timing
// put inside a union to control ctor/dtor timing
union
{
actor_system
system
;
};
union
{
actor_system
system
;
};
fixture
()
{
fixture
()
{
new
(
&
system
)
actor_system
(
cfg
);
new
(
&
system
)
actor_system
(
cfg
);
...
@@ -349,38 +313,30 @@ CAF_TEST(detached_actors_and_schedulued_actors) {
...
@@ -349,38 +313,30 @@ CAF_TEST(detached_actors_and_schedulued_actors) {
CAF_TEST
(
self_receive_with_zero_timeout
)
{
CAF_TEST
(
self_receive_with_zero_timeout
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
self
->
receive
(
self
->
receive
([
&
]
{
CAF_ERROR
(
"Unexpected message"
);
},
[
&
]
{
after
(
chrono
::
seconds
(
0
))
>>
CAF_ERROR
(
"Unexpected message"
);
[]
{
},
// mailbox empty
after
(
chrono
::
seconds
(
0
))
>>
[]
{
});
// mailbox empty
}
);
}
}
CAF_TEST
(
detached_mirror
)
{
CAF_TEST
(
detached_mirror
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
auto
mirror
=
self
->
spawn
<
simple_mirror
,
detached
>
();
auto
mirror
=
self
->
spawn
<
simple_mirror
,
detached
>
();
self
->
send
(
mirror
,
"hello mirror"
);
self
->
send
(
mirror
,
"hello mirror"
);
self
->
receive
(
self
->
receive
(
[](
const
std
::
string
&
msg
)
{
[](
const
std
::
string
&
msg
)
{
CAF_CHECK_EQUAL
(
msg
,
"hello mirror"
);
});
CAF_CHECK_EQUAL
(
msg
,
"hello mirror"
);
}
);
}
}
CAF_TEST
(
send_to_self
)
{
CAF_TEST
(
send_to_self
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
self
->
send
(
self
,
1
,
2
,
3
,
true
);
self
->
send
(
self
,
1
,
2
,
3
,
true
);
self
->
receive
(
self
->
receive
([](
int
a
,
int
b
,
int
c
,
bool
d
)
{
[](
int
a
,
int
b
,
int
c
,
bool
d
)
{
CAF_CHECK_EQUAL
(
a
,
1
);
CAF_CHECK_EQUAL
(
a
,
1
);
CAF_CHECK_EQUAL
(
b
,
2
);
CAF_CHECK_EQUAL
(
b
,
2
);
CAF_CHECK_EQUAL
(
c
,
3
);
CAF_CHECK_EQUAL
(
c
,
3
);
CAF_CHECK_EQUAL
(
d
,
true
);
CAF_CHECK_EQUAL
(
d
,
true
);
});
}
);
self
->
send
(
self
,
message
{});
self
->
send
(
self
,
message
{});
self
->
receive
([]
{});
self
->
receive
([]
{});
}
}
...
@@ -390,63 +346,44 @@ CAF_TEST(echo_actor_messaging) {
...
@@ -390,63 +346,44 @@ CAF_TEST(echo_actor_messaging) {
auto
mecho
=
system
.
spawn
<
echo_actor
>
();
auto
mecho
=
system
.
spawn
<
echo_actor
>
();
self
->
send
(
mecho
,
"hello echo"
);
self
->
send
(
mecho
,
"hello echo"
);
self
->
receive
(
self
->
receive
(
[](
const
std
::
string
&
arg
)
{
[](
const
std
::
string
&
arg
)
{
CAF_CHECK_EQUAL
(
arg
,
"hello echo"
);
});
CAF_CHECK_EQUAL
(
arg
,
"hello echo"
);
}
);
}
}
CAF_TEST
(
delayed_send
)
{
CAF_TEST
(
delayed_send
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
self
->
delayed_send
(
self
,
chrono
::
milliseconds
(
1
),
1
,
2
,
3
);
self
->
delayed_send
(
self
,
chrono
::
milliseconds
(
1
),
1
,
2
,
3
);
self
->
receive
(
self
->
receive
([](
int
a
,
int
b
,
int
c
)
{
[](
int
a
,
int
b
,
int
c
)
{
CAF_CHECK_EQUAL
(
a
,
1
);
CAF_CHECK_EQUAL
(
a
,
1
);
CAF_CHECK_EQUAL
(
b
,
2
);
CAF_CHECK_EQUAL
(
b
,
2
);
CAF_CHECK_EQUAL
(
c
,
3
);
CAF_CHECK_EQUAL
(
c
,
3
);
});
}
);
}
}
CAF_TEST
(
delayed_spawn
)
{
CAF_TEST
(
delayed_spawn
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
self
->
receive
(
after
(
chrono
::
milliseconds
(
1
))
>>
[]
{
});
self
->
receive
(
after
(
chrono
::
milliseconds
(
1
))
>>
[]
{});
system
.
spawn
<
testee1
>
();
system
.
spawn
<
testee1
>
();
}
}
CAF_TEST
(
spawn_event_testee2_test
)
{
CAF_TEST
(
spawn_event_testee2_test
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
spawn_event_testee2
(
self
);
spawn_event_testee2
(
self
);
self
->
receive
(
self
->
receive
([](
ok_atom
)
{
CAF_MESSAGE
(
"Received 'ok'"
);
});
[](
ok_atom
)
{
CAF_MESSAGE
(
"Received 'ok'"
);
}
);
}
}
CAF_TEST
(
function_spawn
)
{
CAF_TEST
(
function_spawn
)
{
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
auto
f
=
[](
const
string
&
name
)
->
behavior
{
auto
f
=
[](
const
string
&
name
)
->
behavior
{
return
(
return
([
name
](
get_atom
)
{
return
std
::
make_tuple
(
name_atom_v
,
name
);
});
[
name
](
get_atom
)
{
return
std
::
make_tuple
(
name_atom_v
,
name
);
}
);
};
};
auto
a1
=
system
.
spawn
(
f
,
"alice"
);
auto
a1
=
system
.
spawn
(
f
,
"alice"
);
auto
a2
=
system
.
spawn
(
f
,
"bob"
);
auto
a2
=
system
.
spawn
(
f
,
"bob"
);
self
->
send
(
a1
,
get_atom_v
);
self
->
send
(
a1
,
get_atom_v
);
self
->
receive
(
self
->
receive
(
[
&
](
name_atom
,
const
string
&
name
)
{
[
&
](
name_atom
,
const
string
&
name
)
{
CAF_CHECK_EQUAL
(
name
,
"alice"
);
});
CAF_CHECK_EQUAL
(
name
,
"alice"
);
}
);
self
->
send
(
a2
,
get_atom_v
);
self
->
send
(
a2
,
get_atom_v
);
self
->
receive
(
self
->
receive
(
[
&
](
name_atom
,
const
string
&
name
)
{
[
&
](
name_atom
,
const
string
&
name
)
{
CAF_CHECK_EQUAL
(
name
,
"bob"
);
});
CAF_CHECK_EQUAL
(
name
,
"bob"
);
}
);
self
->
send_exit
(
a1
,
exit_reason
::
user_shutdown
);
self
->
send_exit
(
a1
,
exit_reason
::
user_shutdown
);
self
->
send_exit
(
a2
,
exit_reason
::
user_shutdown
);
self
->
send_exit
(
a2
,
exit_reason
::
user_shutdown
);
}
}
...
@@ -454,12 +391,10 @@ CAF_TEST(function_spawn) {
...
@@ -454,12 +391,10 @@ CAF_TEST(function_spawn) {
using
typed_testee
=
typed_actor
<
replies_to
<
abc_atom
>::
with
<
std
::
string
>>
;
using
typed_testee
=
typed_actor
<
replies_to
<
abc_atom
>::
with
<
std
::
string
>>
;
typed_testee
::
behavior_type
testee
()
{
typed_testee
::
behavior_type
testee
()
{
return
{
return
{[](
abc_atom
)
{
[](
abc_atom
)
{
CAF_MESSAGE
(
"received 'abc'"
);
CAF_MESSAGE
(
"received 'abc'"
);
return
"abc"
;
return
"abc"
;
}};
}
};
}
}
CAF_TEST
(
typed_await
)
{
CAF_TEST
(
typed_await
)
{
...
@@ -473,18 +408,16 @@ CAF_TEST(constructor_attach) {
...
@@ -473,18 +408,16 @@ CAF_TEST(constructor_attach) {
class
testee
:
public
event_based_actor
{
class
testee
:
public
event_based_actor
{
public:
public:
testee
(
actor_config
&
cfg
,
actor
buddy
)
testee
(
actor_config
&
cfg
,
actor
buddy
)
:
event_based_actor
(
cfg
),
:
event_based_actor
(
cfg
),
buddy_
(
buddy
)
{
buddy_
(
buddy
)
{
attach_functor
(
attach_functor
([
=
](
const
error
&
reason
)
{
[
=
](
const
error
&
reason
)
{
send
(
buddy
,
ok_atom_v
,
reason
);
});
send
(
buddy
,
ok_atom_v
,
reason
);
});
}
}
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
return
{
return
{
[]
{
[]
{
// nop
// nop
}
}
,
};
};
}
}
...
@@ -498,17 +431,16 @@ CAF_TEST(constructor_attach) {
...
@@ -498,17 +431,16 @@ CAF_TEST(constructor_attach) {
class
spawner
:
public
event_based_actor
{
class
spawner
:
public
event_based_actor
{
public:
public:
spawner
(
actor_config
&
cfg
)
spawner
(
actor_config
&
cfg
)
:
event_based_actor
(
cfg
),
:
event_based_actor
(
cfg
),
downs_
(
0
),
downs_
(
0
),
testee_
(
spawn
<
testee
,
monitored
>
(
this
))
{
testee_
(
spawn
<
testee
,
monitored
>
(
this
))
{
set_down_handler
([
=
](
down_msg
&
msg
)
{
set_down_handler
([
=
](
down_msg
&
msg
)
{
CAF_CHECK_EQUAL
(
msg
.
reason
,
exit_reason
::
user_shutdown
);
CAF_CHECK_EQUAL
(
msg
.
reason
,
exit_reason
::
user_shutdown
);
if
(
++
downs_
==
2
)
if
(
++
downs_
==
2
)
quit
(
msg
.
reason
);
quit
(
msg
.
reason
);
});
});
set_exit_handler
([
=
](
exit_msg
&
msg
)
{
set_exit_handler
(
send_exit
(
testee_
,
std
::
move
(
msg
.
reason
));
[
=
](
exit_msg
&
msg
)
{
send_exit
(
testee_
,
std
::
move
(
msg
.
reason
));
});
});
}
}
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
...
@@ -541,7 +473,7 @@ CAF_TEST(kill_the_immortal) {
...
@@ -541,7 +473,7 @@ CAF_TEST(kill_the_immortal) {
return
{
return
{
[]
{
[]
{
// nop
// nop
}
}
,
};
};
});
});
scoped_actor
self
{
system
};
scoped_actor
self
{
system
};
...
@@ -554,24 +486,22 @@ CAF_TEST(move_only_argument) {
...
@@ -554,24 +486,22 @@ CAF_TEST(move_only_argument) {
unique_int
uptr
{
new
int
(
42
)};
unique_int
uptr
{
new
int
(
42
)};
auto
wrapper
=
[](
event_based_actor
*
self
,
unique_int
ptr
)
->
behavior
{
auto
wrapper
=
[](
event_based_actor
*
self
,
unique_int
ptr
)
->
behavior
{
auto
i
=
*
ptr
;
auto
i
=
*
ptr
;
return
{
return
{[
=
](
float
)
{
[
=
](
float
)
{
self
->
quit
();
self
->
quit
();
return
i
;
return
i
;
}};
}
};
};
};
auto
f
=
make_function_view
(
system
.
spawn
(
wrapper
,
std
::
move
(
uptr
)));
auto
f
=
make_function_view
(
system
.
spawn
(
wrapper
,
std
::
move
(
uptr
)));
CAF_CHECK_EQUAL
(
to_string
(
f
(
1.
f
)),
"(42)"
);
CAF_CHECK_EQUAL
(
to_string
(
f
(
1.
f
)),
"(42)"
);
}
}
CAF_TEST
(
move
-
only
function
object
)
{
CAF_TEST
(
move
-
only
function
object
)
{
struct
move_only_fun
{
struct
move_only_fun
{
move_only_fun
()
=
default
;
move_only_fun
()
=
default
;
move_only_fun
(
const
move_only_fun
&
)
=
delete
;
move_only_fun
(
const
move_only_fun
&
)
=
delete
;
move_only_fun
(
move_only_fun
&&
)
=
default
;
move_only_fun
(
move_only_fun
&&
)
=
default
;
behavior
operator
()(
event_based_actor
*
)
{
behavior
operator
()(
event_based_actor
*
)
{
return
{};
return
{};
}
}
};
};
...
...
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