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
8a47221b
Commit
8a47221b
authored
Dec 11, 2017
by
Dominik Charousset
Committed by
Dominik Charousset
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up-/downstream message names in docs
parent
665c4ff7
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
68 additions
and
76 deletions
+68
-76
doc/mailbox.graffle
doc/mailbox.graffle
+0
-0
libcaf_core/caf/abstract_actor.hpp
libcaf_core/caf/abstract_actor.hpp
+11
-11
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+19
-18
libcaf_core/caf/detail/init_fun_factory.hpp
libcaf_core/caf/detail/init_fun_factory.hpp
+1
-0
libcaf_core/caf/detail/stream_sink_impl.hpp
libcaf_core/caf/detail/stream_sink_impl.hpp
+1
-1
libcaf_core/caf/detail/stream_stage_impl.hpp
libcaf_core/caf/detail/stream_stage_impl.hpp
+1
-1
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+16
-0
libcaf_core/src/actor_config.cpp
libcaf_core/src/actor_config.cpp
+5
-1
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+0
-1
libcaf_core/src/scoped_actor.cpp
libcaf_core/src/scoped_actor.cpp
+13
-6
libcaf_core/test/streaming_classes.cpp
libcaf_core/test/streaming_classes.cpp
+1
-37
No files found.
doc/mailbox.graffle
View file @
8a47221b
No preview for this file type
libcaf_core/caf/abstract_actor.hpp
View file @
8a47221b
libcaf_core/caf/actor_system.hpp
View file @
8a47221b
...
...
@@ -46,8 +46,8 @@
#include "caf/composable_behavior_based_actor.hpp"
#include "caf/prohibit_top_level_spawn_marker.hpp"
#include "caf/detail/spawn_fwd.hpp"
#include "caf/detail/init_fun_factory.hpp"
#include "caf/detail/spawn_fwd.hpp"
namespace
caf
{
...
...
@@ -502,32 +502,17 @@ public:
/// @warning must be called by thread which is about to terminate
void
thread_terminates
();
/// @endcond
private:
template
<
class
T
>
void
check_invariants
()
{
static_assert
(
!
std
::
is_base_of
<
prohibit_top_level_spawn_marker
,
T
>::
value
,
"This actor type cannot be spawned throught an actor system. "
"Probably you have tried to spawn a broker or opencl actor."
);
}
expected
<
strong_actor_ptr
>
dyn_spawn_impl
(
const
std
::
string
&
name
,
message
&
args
,
execution_unit
*
ctx
,
bool
check_interface
,
optional
<
const
mpi
&>
expected_ifs
);
template
<
class
C
,
spawn_options
Os
,
class
...
Ts
>
infer_handle_from_class_t
<
C
>
spawn_impl
(
actor_config
&
cfg
,
Ts
&&
...
xs
)
{
static_assert
(
is_unbound
(
Os
),
"top-level spawns cannot have monitor or link flag"
);
// TODO: use `if constexpr` when switching to C++17
if
(
has_detach_flag
(
Os
)
||
std
::
is_base_of
<
blocking_actor
,
C
>::
value
)
cfg
.
flags
|=
abstract_actor
::
is_detached_flag
;
if
(
has_hide_flag
(
Os
))
cfg
.
flags
|=
abstract_actor
::
is_hidden_flag
;
if
(
!
cfg
.
host
)
if
(
cfg
.
host
==
nullptr
)
cfg
.
host
=
dummy_execution_unit
();
CAF_SET_LOGGER_SYS
(
this
);
auto
res
=
make_actor
<
C
>
(
next_actor_id
(),
node
(),
this
,
...
...
@@ -537,6 +522,22 @@ private:
return
res
;
}
/// @endcond
private:
template
<
class
T
>
void
check_invariants
()
{
static_assert
(
!
std
::
is_base_of
<
prohibit_top_level_spawn_marker
,
T
>::
value
,
"This actor type cannot be spawned throught an actor system. "
"Probably you have tried to spawn a broker or opencl actor."
);
}
expected
<
strong_actor_ptr
>
dyn_spawn_impl
(
const
std
::
string
&
name
,
message
&
args
,
execution_unit
*
ctx
,
bool
check_interface
,
optional
<
const
mpi
&>
expected_ifs
);
/// Sets the internal actor for dynamic spawn operations.
inline
void
spawn_serv
(
strong_actor_ptr
x
)
{
internal_actors_
[
internal_actor_id
(
atom
(
"SpawnServ"
))]
=
std
::
move
(
x
);
...
...
libcaf_core/caf/detail/init_fun_factory.hpp
View file @
8a47221b
...
...
@@ -25,6 +25,7 @@
#include "caf/fwd.hpp"
#include "caf/detail/apply_args.hpp"
#include "caf/detail/spawn_fwd.hpp"
#include "caf/detail/type_traits.hpp"
namespace
caf
{
...
...
libcaf_core/caf/detail/stream_sink_impl.hpp
View file @
8a47221b
...
...
@@ -67,7 +67,7 @@ public:
}
error
handle
(
inbound_path
*
,
downstream_msg
::
batch
&
x
)
override
{
CAF_LOG_TRACE
(
CAF_ARG
(
msg
));
CAF_LOG_TRACE
(
CAF_ARG
(
x
));
using
vec_type
=
std
::
vector
<
input_type
>
;
if
(
x
.
xs
.
match_elements
<
vec_type
>
())
{
auto
&
xs
=
x
.
xs
.
get_as
<
vec_type
>
(
0
);
...
...
libcaf_core/caf/detail/stream_stage_impl.hpp
View file @
8a47221b
...
...
@@ -64,7 +64,7 @@ public:
}
error
handle
(
inbound_path
*
,
downstream_msg
::
batch
&
x
)
override
{
CAF_LOG_TRACE
(
CAF_ARG
(
msg
));
CAF_LOG_TRACE
(
CAF_ARG
(
x
));
using
vec_type
=
std
::
vector
<
output_type
>
;
if
(
x
.
xs
.
match_elements
<
vec_type
>
())
{
auto
&
xs
=
x
.
xs
.
get_as
<
vec_type
>
(
0
);
...
...
libcaf_core/caf/local_actor.hpp
View file @
8a47221b
...
...
@@ -58,6 +58,11 @@ namespace caf {
/// living in an own thread or cooperatively scheduled.
class
local_actor
:
public
monitorable_actor
{
public:
// -- member types -----------------------------------------------------------
/// Defines a monotonic clock suitable for measuring intervals.
using
clock_type
=
std
::
chrono
::
steady_clock
;
// -- constructors, destructors, and assignment operators --------------------
local_actor
(
actor_config
&
cfg
);
...
...
@@ -70,6 +75,17 @@ public:
virtual
void
launch
(
execution_unit
*
eu
,
bool
lazy
,
bool
hide
)
=
0
;
// -- time -------------------------------------------------------------------
/// Returns the current time.
clock_type
::
time_point
now
()
const
noexcept
;
/// Returns the difference between `t0` and `t1`, allowing the clock to
/// return any arbitrary value depending on the measurement that took place.
clock_type
::
duration
difference
(
atom_value
measurement
,
clock_type
::
time_point
t0
,
clock_type
::
time_point
t1
);
// -- timeout management -----------------------------------------------------
/// Requests a new timeout for `mid`.
...
...
libcaf_core/src/actor_config.cpp
View file @
8a47221b
...
...
@@ -33,8 +33,12 @@ std::string to_string(const actor_config& x) {
// Note: x.groups is an input range. Traversing it is emptying it, hence we
// cannot look inside the range here.
std
::
string
result
=
"actor_config("
;
bool
first
=
false
;
auto
add
=
[
&
](
int
flag
,
const
char
*
name
)
{
if
((
x
.
flags
&
flag
)
!=
0
)
{
if
(
first
)
first
=
false
;
else
result
+=
", "
;
result
+=
name
;
}
...
...
libcaf_core/src/actor_system.cpp
View file @
8a47221b
...
...
@@ -408,7 +408,6 @@ actor_clock& actor_system::clock() noexcept {
return
scheduler
().
clock
();
}
void
actor_system
::
inc_detached_threads
()
{
++
detached
;
}
...
...
libcaf_core/src/scoped_actor.cpp
View file @
8a47221b
...
...
@@ -30,7 +30,7 @@ namespace {
class
impl
:
public
blocking_actor
{
public:
impl
(
actor_config
&
cfg
)
:
blocking_actor
(
cfg
)
{
setf
(
is_detached_flag
);
// nop
}
void
act
()
override
{
...
...
@@ -40,6 +40,14 @@ public:
const
char
*
name
()
const
override
{
return
"scoped_actor"
;
}
void
launch
(
execution_unit
*
,
bool
,
bool
hide
)
override
{
CAF_LOG_TRACE
(
CAF_ARG
(
hide
));
CAF_ASSERT
(
getf
(
is_blocking_flag
));
if
(
!
hide
)
register_at_system
();
initialize
();
}
};
}
// namespace <anonymous>
...
...
@@ -47,12 +55,11 @@ public:
scoped_actor
::
scoped_actor
(
actor_system
&
sys
,
bool
hide
)
:
context_
(
&
sys
)
{
CAF_SET_LOGGER_SYS
(
&
sys
);
actor_config
cfg
{
&
context_
};
self_
=
make_actor
<
impl
,
strong_actor_ptr
>
(
sys
.
next_actor_id
(),
sys
.
node
(),
&
sys
,
cfg
)
;
if
(
!
hide
)
ptr
()
->
register_at_system
(
);
if
(
hide
)
cfg
.
flags
|=
abstract_actor
::
is_hidden_flag
;
auto
hdl
=
sys
.
spawn_impl
<
impl
,
no_spawn_options
>
(
cfg
);
self_
=
actor_cast
<
strong_actor_ptr
>
(
std
::
move
(
hdl
)
);
prev_
=
CAF_SET_AID
(
self_
->
id
());
ptr
()
->
initialize
();
}
scoped_actor
::~
scoped_actor
()
{
...
...
libcaf_core/test/streaming_classes.cpp
View file @
8a47221b
...
...
@@ -221,43 +221,7 @@ using mboxqueue = wdrr_fixed_multiplexed_queue<mboxpolicy, default_queue,
umsg_queue
,
dmsg_queue
,
default_queue
>
;
// -- entity -------------------------------------------------------------------
class
abstract_clock
{
public:
// -- member types -----------------------------------------------------------
using
time_point
=
std
::
chrono
::
steady_clock
::
time_point
;
// -- constructors, destructors, and assignment operators --------------------
virtual
~
abstract_clock
()
{
// nop
}
virtual
time_point
now
()
const
noexcept
=
0
;
};
class
fake_clock
:
public
abstract_clock
{
public:
fake_clock
(
time_point
*
global_time
)
:
global_time_
(
global_time
)
{
// nop
}
time_point
now
()
const
noexcept
override
{
return
*
global_time_
;
}
private:
time_point
*
global_time_
;
};
class
steady_clock
:
public
abstract_clock
{
public:
time_point
now
()
const
noexcept
override
{
return
std
::
chrono
::
steady_clock
::
now
();
}
};
// -- entity and mailbox visitor -----------------------------------------------
class
entity
:
public
extend
<
local_actor
,
entity
>::
with
<
mixin
::
sender
>
{
public:
...
...
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