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
85bc667e
Commit
85bc667e
authored
Aug 03, 2023
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow configs to provided mailbox factories
parent
cc7f3496
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
0 deletions
+23
-0
libcaf_core/caf/actor_system.cpp
libcaf_core/caf/actor_system.cpp
+4
-0
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+9
-0
libcaf_core/caf/actor_system_config.cpp
libcaf_core/caf/actor_system_config.cpp
+4
-0
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+6
-0
No files found.
libcaf_core/caf/actor_system.cpp
View file @
85bc667e
...
...
@@ -541,4 +541,8 @@ void actor_system::release_private_thread(detail::private_thread* ptr) {
private_threads_
.
release
(
ptr
);
}
detail
::
mailbox_factory
*
actor_system
::
mailbox_factory
()
{
return
cfg_
.
mailbox_factory
();
}
}
// namespace caf
libcaf_core/caf/actor_system.hpp
View file @
85bc667e
...
...
@@ -398,6 +398,7 @@ public:
infer_handle_from_class_t
<
C
>
spawn
(
Ts
&&
...
xs
)
{
check_invariants
<
C
>
();
actor_config
cfg
;
cfg
.
mbox_factory
=
mailbox_factory
();
return
spawn_impl
<
C
,
Os
>
(
cfg
,
detail
::
spawn_fwd
<
Ts
>
(
xs
)...);
}
...
...
@@ -436,6 +437,7 @@ public:
static_assert
(
spawnable
,
"cannot spawn function-based actor with given arguments"
);
actor_config
cfg
;
cfg
.
mbox_factory
=
mailbox_factory
();
return
spawn_functor
<
Os
>
(
detail
::
bool_token
<
spawnable
>
{},
cfg
,
fun
,
std
::
forward
<
Ts
>
(
xs
)...);
}
...
...
@@ -500,6 +502,7 @@ public:
infer_handle_from_fun_t
<
F
>
spawn_in_groups
(
std
::
initializer_list
<
group
>
gs
,
F
fun
,
Ts
&&
...
xs
)
{
actor_config
cfg
;
cfg
.
mbox_factory
=
mailbox_factory
();
return
spawn_fun_in_groups
<
Os
>
(
cfg
,
gs
.
begin
(),
gs
.
end
(),
fun
,
std
::
forward
<
Ts
>
(
xs
)...);
}
...
...
@@ -508,6 +511,7 @@ public:
template
<
spawn_options
Os
=
no_spawn_options
,
class
Gs
,
class
F
,
class
...
Ts
>
infer_handle_from_fun_t
<
F
>
spawn_in_groups
(
const
Gs
&
gs
,
F
fun
,
Ts
&&
...
xs
)
{
actor_config
cfg
;
cfg
.
mbox_factory
=
mailbox_factory
();
return
spawn_fun_in_groups
<
Os
>
(
cfg
,
gs
.
begin
(),
gs
.
end
(),
fun
,
std
::
forward
<
Ts
>
(
xs
)...);
}
...
...
@@ -524,6 +528,7 @@ public:
infer_handle_from_class_t
<
T
>
spawn_in_groups
(
std
::
initializer_list
<
group
>
gs
,
Ts
&&
...
xs
)
{
actor_config
cfg
;
cfg
.
mbox_factory
=
mailbox_factory
();
return
spawn_class_in_groups
<
T
,
Os
>
(
cfg
,
gs
.
begin
(),
gs
.
end
(),
std
::
forward
<
Ts
>
(
xs
)...);
}
...
...
@@ -532,6 +537,7 @@ public:
template
<
class
T
,
spawn_options
Os
=
no_spawn_options
,
class
Gs
,
class
...
Ts
>
infer_handle_from_class_t
<
T
>
spawn_in_groups
(
const
Gs
&
gs
,
Ts
&&
...
xs
)
{
actor_config
cfg
;
cfg
.
mbox_factory
=
mailbox_factory
();
return
spawn_class_in_groups
<
T
,
Os
>
(
cfg
,
gs
.
begin
(),
gs
.
end
(),
std
::
forward
<
Ts
>
(
xs
)...);
}
...
...
@@ -696,6 +702,7 @@ public:
"only scheduled actors may get spawned inactively"
);
CAF_SET_LOGGER_SYS
(
this
);
actor_config
cfg
{
dummy_execution_unit
(),
nullptr
};
cfg
.
mbox_factory
=
mailbox_factory
();
auto
res
=
make_actor
<
Impl
>
(
next_actor_id
(),
node
(),
this
,
cfg
,
std
::
forward
<
Ts
>
(
xs
)...);
auto
ptr
=
static_cast
<
Impl
*>
(
actor_cast
<
abstract_actor
*>
(
res
));
...
...
@@ -790,6 +797,8 @@ private:
config_serv_
=
std
::
move
(
x
);
}
detail
::
mailbox_factory
*
mailbox_factory
();
// -- member variables -------------------------------------------------------
/// Provides system-wide callbacks for several actor operations.
...
...
libcaf_core/caf/actor_system_config.cpp
View file @
85bc667e
...
...
@@ -478,6 +478,10 @@ actor_system_config::extract_config_file_path(string_list& args) {
}
}
detail
::
mailbox_factory
*
actor_system_config
::
mailbox_factory
()
{
return
nullptr
;
}
const
settings
&
content
(
const
actor_system_config
&
cfg
)
{
return
cfg
.
content
;
}
...
...
libcaf_core/caf/actor_system_config.hpp
View file @
85bc667e
...
...
@@ -32,6 +32,10 @@ namespace caf {
/// Configures an `actor_system` on startup.
class
CAF_CORE_EXPORT
actor_system_config
{
public:
// -- friends ----------------------------------------------------------------
friend
class
actor_system
;
// -- member types -----------------------------------------------------------
using
hook_factory
=
std
::
function
<
io
::
hook
*
(
actor_system
&
)
>
;
...
...
@@ -303,6 +307,8 @@ protected:
config_option_set
custom_options_
;
private:
virtual
detail
::
mailbox_factory
*
mailbox_factory
();
void
set_remainder
(
string_list
args
);
mutable
std
::
vector
<
char
*>
c_args_remainder_
;
...
...
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