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
11d1732a
Commit
11d1732a
authored
Mar 04, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove blocking_api flag
parent
23f4a9d2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
11 additions
and
38 deletions
+11
-38
examples/aout.cpp
examples/aout.cpp
+1
-1
examples/message_passing/calculator.cpp
examples/message_passing/calculator.cpp
+1
-2
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+1
-12
libcaf_core/caf/event_based_actor.hpp
libcaf_core/caf/event_based_actor.hpp
+1
-2
libcaf_core/caf/spawn_options.hpp
libcaf_core/caf/spawn_options.hpp
+0
-12
libcaf_core/caf/typed_event_based_actor.hpp
libcaf_core/caf/typed_event_based_actor.hpp
+2
-4
libcaf_core/src/abstract_coordinator.cpp
libcaf_core/src/abstract_coordinator.cpp
+2
-2
libcaf_core/test/dynamic_spawn.cpp
libcaf_core/test/dynamic_spawn.cpp
+1
-1
libcaf_core/test/request.cpp
libcaf_core/test/request.cpp
+2
-2
No files found.
examples/aout.cpp
View file @
11d1732a
...
...
@@ -15,7 +15,7 @@ using std::endl;
int
main
()
{
actor_system
system
;
for
(
int
i
=
1
;
i
<=
50
;
++
i
)
{
system
.
spawn
<
blocking_api
>
([
i
](
blocking_actor
*
self
)
{
system
.
spawn
([
i
](
blocking_actor
*
self
)
{
aout
(
self
)
<<
"Hi there! This is actor nr. "
<<
i
<<
"!"
<<
endl
;
std
::
random_device
rd
;
...
...
examples/message_passing/calculator.cpp
View file @
11d1732a
...
...
@@ -92,8 +92,7 @@ int main() {
actor_system
system
;
scoped_actor
self
{
system
};
aout
(
self
)
<<
"blocking actor:"
<<
endl
;
self
->
spawn
(
tester
<
actor
>
,
self
->
spawn
<
blocking_api
>
(
blocking_calculator
),
1
,
2
);
self
->
spawn
(
tester
<
actor
>
,
self
->
spawn
(
blocking_calculator
),
1
,
2
);
self
->
await_all_other_actors_done
();
aout
(
self
)
<<
"event-based actor:"
<<
endl
;
self
->
spawn
(
tester
<
actor
>
,
self
->
spawn
(
calculator
),
3
,
4
);
...
...
libcaf_core/caf/actor_system.hpp
View file @
11d1732a
...
...
@@ -272,13 +272,6 @@ public:
template
<
spawn_options
Os
,
class
C
,
class
F
,
class
...
Ts
>
infer_handle_from_class_t
<
C
>
spawn_functor_impl
(
actor_config
&
cfg
,
F
&
fun
,
Ts
&&
...
xs
)
{
constexpr
bool
is_blocking
=
std
::
is_base_of
<
blocking_actor
,
C
>::
value
;
static_assert
(
is_blocking
||
!
has_blocking_api_flag
(
Os
),
"blocking functor-based actors "
"need to be spawned using the blocking_api flag"
);
static_assert
(
!
is_blocking
||
has_blocking_api_flag
(
Os
),
"non-blocking functor-based actors "
"cannot be spawned using the blocking_api flag"
);
detail
::
init_fun_factory
<
C
,
F
>
fac
;
cfg
.
init_fun
=
fac
(
std
::
move
(
fun
),
std
::
forward
<
Ts
>
(
xs
)...);
return
spawn_impl
<
C
,
Os
>
(
cfg
);
...
...
@@ -409,16 +402,12 @@ private:
template
<
class
C
,
spawn_options
Os
,
class
...
Ts
>
infer_handle_from_class_t
<
C
>
spawn_impl
(
actor_config
&
cfg
,
Ts
&&
...
xs
)
{
static_assert
(
!
std
::
is_base_of
<
blocking_actor
,
C
>::
value
||
has_blocking_api_flag
(
Os
),
"C is derived from blocking_actor but "
"spawned without blocking_api_flag"
);
static_assert
(
is_unbound
(
Os
),
"top-level spawns cannot have monitor or link flag"
);
cfg
.
flags
=
has_priority_aware_flag
(
Os
)
?
abstract_actor
::
is_priority_aware_flag
:
0
;
if
(
has_detach_flag
(
Os
)
||
has_blocking_api_flag
(
Os
)
)
if
(
has_detach_flag
(
Os
)
||
std
::
is_base_of
<
blocking_actor
,
C
>::
value
)
cfg
.
flags
|=
abstract_actor
::
is_detached_flag
;
if
(
!
cfg
.
host
)
cfg
.
host
=
dummy_execution_unit
();
...
...
libcaf_core/caf/event_based_actor.hpp
View file @
11d1732a
...
...
@@ -33,8 +33,7 @@
namespace
caf
{
/// A cooperatively scheduled, event-based actor implementation. This is the
/// recommended base class for user-defined actors and is used implicitly when
/// spawning functor-based actors without the `blocking_api` flag.
/// recommended base class for user-defined actors.
/// @extends local_actor
class
event_based_actor
:
public
abstract_event_based_actor
<
behavior
,
true
>
{
public:
...
...
libcaf_core/caf/spawn_options.hpp
View file @
11d1732a
...
...
@@ -35,7 +35,6 @@ enum class spawn_options : int {
monitor_flag
=
0x02
,
detach_flag
=
0x04
,
hide_flag
=
0x08
,
blocking_api_flag
=
0x10
,
priority_aware_flag
=
0x20
,
lazy_init_flag
=
0x40
};
...
...
@@ -66,11 +65,6 @@ constexpr spawn_options detached = spawn_options::detach_flag;
/// Causes the runtime to ignore the new actor in `await_all_actors_done()`.
constexpr
spawn_options
hidden
=
spawn_options
::
hide_flag
;
/// Causes the new actor to opt in to the blocking API,
/// i.e., the actor uses a context-switching or thread-based backend
/// instead of the default event-based implementation.
constexpr
spawn_options
blocking_api
=
spawn_options
::
blocking_api_flag
;
/// Causes the new actor to evaluate message priorities.
/// @note This implicitly causes the actor to run in its own thread.
constexpr
spawn_options
priority_aware
=
spawn_options
::
priority_aware_flag
;
...
...
@@ -115,12 +109,6 @@ constexpr bool has_monitor_flag(spawn_options opts) {
return
has_spawn_option
(
opts
,
monitored
);
}
/// Checks wheter the {@link blocking_api} flag is set in `opts`.
/// @relates spawn_options
constexpr
bool
has_blocking_api_flag
(
spawn_options
opts
)
{
return
has_spawn_option
(
opts
,
blocking_api
);
}
/// Checks wheter the {@link lazy_init} flag is set in `opts`.
/// @relates spawn_options
constexpr
bool
has_lazy_init_flag
(
spawn_options
opts
)
{
...
...
libcaf_core/caf/typed_event_based_actor.hpp
View file @
11d1732a
...
...
@@ -31,10 +31,8 @@
namespace
caf
{
/// A cooperatively scheduled, event-based actor implementation with strong type
/// checking. This is the recommended base class for user-defined actors and is
/// used implicitly when spawning typed, functor-based actors without the
/// `blocking_api` flag.
/// A cooperatively scheduled, event-based actor
/// implementation with static type-checking.
/// @extends local_actor
template
<
class
...
Sigs
>
class
typed_event_based_actor
...
...
libcaf_core/src/abstract_coordinator.cpp
View file @
11d1732a
...
...
@@ -321,8 +321,8 @@ void printer_loop(blocking_actor* self) {
void
abstract_coordinator
::
start
()
{
CAF_LOG_TRACE
(
""
);
// launch utility actors
timer_
=
system_
.
spawn
<
timer_actor
,
hidden
+
detached
+
blocking_api
>
();
printer_
=
system_
.
spawn
<
hidden
+
detached
+
blocking_api
>
(
printer_loop
);
timer_
=
system_
.
spawn
<
timer_actor
,
hidden
+
detached
>
();
printer_
=
system_
.
spawn
<
hidden
+
detached
>
(
printer_loop
);
}
void
abstract_coordinator
::
init
(
actor_system_config
&
cfg
)
{
...
...
libcaf_core/test/dynamic_spawn.cpp
View file @
11d1732a
...
...
@@ -511,7 +511,7 @@ CAF_TEST(spawn_event_testee2_test) {
#ifndef CAF_WINDOWS
CAF_TEST
(
requests
)
{
scoped_actor
self
{
system
};
auto
sync_testee
=
system
.
spawn
<
blocking_api
>
([](
blocking_actor
*
s
)
{
auto
sync_testee
=
system
.
spawn
([](
blocking_actor
*
s
)
{
s
->
receive
(
on
(
"hi"
,
arg_match
)
>>
[
&
](
actor
from
)
{
s
->
request
(
from
,
"whassup?"
,
s
).
receive
(
...
...
libcaf_core/test/request.cpp
View file @
11d1732a
...
...
@@ -302,7 +302,7 @@ CAF_TEST(pending_quit) {
CAF_TEST
(
request
)
{
scoped_actor
self
{
system
};
self
->
spawn
<
monitored
+
blocking_api
>
([](
blocking_actor
*
s
)
{
self
->
spawn
<
monitored
>
([](
blocking_actor
*
s
)
{
int
invocations
=
0
;
auto
foi
=
s
->
spawn
<
float_or_int
,
linked
>
();
s
->
send
(
foi
,
i_atom
::
value
);
...
...
@@ -464,7 +464,7 @@ CAF_TEST(request) {
self
->
await_all_other_actors_done
();
CAF_MESSAGE
(
"`await_all_other_actors_done` finished"
);
// test use case 3
self
->
spawn
<
monitored
+
blocking_api
>
([](
blocking_actor
*
s
)
{
// client
self
->
spawn
<
monitored
>
([](
blocking_actor
*
s
)
{
// client
auto
serv
=
s
->
spawn
<
linked
>
(
server
);
// server
auto
work
=
s
->
spawn
<
linked
>
([]()
->
behavior
{
// worker
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