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
ade02937
Commit
ade02937
authored
Feb 13, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move `detail::disposer` to its own header
parent
963a0bc8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
25 deletions
+55
-25
libcaf_core/caf/actor_companion.hpp
libcaf_core/caf/actor_companion.hpp
+7
-12
libcaf_core/caf/detail/disposer.hpp
libcaf_core/caf/detail/disposer.hpp
+39
-0
libcaf_core/caf/detail/memory.hpp
libcaf_core/caf/detail/memory.hpp
+0
-7
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+5
-0
libcaf_core/caf/local_actor.hpp
libcaf_core/caf/local_actor.hpp
+1
-0
libcaf_core/caf/mailbox_element.hpp
libcaf_core/caf/mailbox_element.hpp
+2
-0
libcaf_core/caf/memory_managed.hpp
libcaf_core/caf/memory_managed.hpp
+0
-6
libcaf_io/caf/io/network/multiplexer.hpp
libcaf_io/caf/io/network/multiplexer.hpp
+1
-0
No files found.
libcaf_core/caf/actor_companion.hpp
View file @
ade02937
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include "caf/mixin/sync_sender.hpp"
#include "caf/mixin/sync_sender.hpp"
#include "caf/mixin/behavior_stack_based.hpp"
#include "caf/mixin/behavior_stack_based.hpp"
#include "caf/detail/
memory
.hpp"
#include "caf/detail/
disposer
.hpp"
#include "caf/detail/shared_spinlock.hpp"
#include "caf/detail/shared_spinlock.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -39,16 +39,13 @@ namespace caf {
...
@@ -39,16 +39,13 @@ namespace caf {
* callback to another object, thus serving as gateway to
* callback to another object, thus serving as gateway to
* allow any object to interact with other actors.
* allow any object to interact with other actors.
*/
*/
class
actor_companion
:
public
extend
<
local_actor
,
actor_companion
>::
class
actor_companion
with
<
mixin
::
behavior_stack_based
<
behavior
>::
impl
,
:
public
extend
<
local_actor
,
actor_companion
>::
mixin
::
sync_sender
<
nonblocking_response_handle_tag
>::
impl
>
{
with
<
mixin
::
behavior_stack_based
<
behavior
>::
impl
,
mixin
::
sync_sender
<
nonblocking_response_handle_tag
>::
impl
>
{
using
lock_type
=
detail
::
shared_spinlock
;
public:
public:
using
lock_type
=
detail
::
shared_spinlock
;
using
message_pointer
=
std
::
unique_ptr
<
mailbox_element
,
detail
::
disposer
>
;
using
message_pointer
=
std
::
unique_ptr
<
mailbox_element
,
detail
::
disposer
>
;
using
enqueue_handler
=
std
::
function
<
void
(
message_pointer
)
>
;
using
enqueue_handler
=
std
::
function
<
void
(
message_pointer
)
>
;
/**
/**
...
@@ -64,16 +61,14 @@ class actor_companion : public extend<local_actor, actor_companion>::
...
@@ -64,16 +61,14 @@ class actor_companion : public extend<local_actor, actor_companion>::
void
on_enqueue
(
enqueue_handler
handler
);
void
on_enqueue
(
enqueue_handler
handler
);
void
enqueue
(
const
actor_addr
&
sender
,
message_id
mid
,
void
enqueue
(
const
actor_addr
&
sender
,
message_id
mid
,
message
content
,
execution_unit
*
host
)
override
;
message
content
,
execution_unit
*
host
)
override
;
private:
private:
// set by parent to define custom enqueue action
// set by parent to define custom enqueue action
enqueue_handler
m_on_enqueue
;
enqueue_handler
m_on_enqueue
;
// guards access to m_handler
// guards access to m_handler
lock_type
m_lock
;
lock_type
m_lock
;
};
};
/**
/**
...
...
libcaf_core/caf/detail/disposer.hpp
0 → 100644
View file @
ade02937
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2014 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_DETAIL_DISPOSER_HPP
#define CAF_DETAIL_DISPOSER_HPP
#include "caf/memory_managed.hpp"
namespace
caf
{
namespace
detail
{
class
disposer
{
public:
inline
void
operator
()(
memory_managed
*
ptr
)
const
{
ptr
->
request_deletion
();
}
};
}
// namespace detail
}
// namespace caf
#endif // CAF_DETAIL_DISPOSER_HPP
libcaf_core/caf/detail/memory.hpp
View file @
ade02937
...
@@ -45,13 +45,6 @@ constexpr size_t s_max_elements = 20; // don't create > 20 elements
...
@@ -45,13 +45,6 @@ constexpr size_t s_max_elements = 20; // don't create > 20 elements
}
// namespace <anonymous>
}
// namespace <anonymous>
struct
disposer
{
inline
void
operator
()(
memory_managed
*
ptr
)
const
{
ptr
->
request_deletion
();
}
};
class
instance_wrapper
{
class
instance_wrapper
{
public:
public:
...
...
libcaf_core/caf/fwd.hpp
View file @
ade02937
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#ifndef CAF_FWD_HPP
#ifndef CAF_FWD_HPP
#define CAF_FWD_HPP
#define CAF_FWD_HPP
#include <memory>
#include <cstdint>
#include <cstdint>
namespace
caf
{
namespace
caf
{
...
@@ -45,6 +46,7 @@ class execution_unit;
...
@@ -45,6 +46,7 @@ class execution_unit;
class
abstract_actor
;
class
abstract_actor
;
class
abstract_group
;
class
abstract_group
;
class
blocking_actor
;
class
blocking_actor
;
class
mailbox_element
;
class
message_handler
;
class
message_handler
;
class
uniform_type_info
;
class
uniform_type_info
;
class
event_based_actor
;
class
event_based_actor
;
...
@@ -90,6 +92,7 @@ namespace scheduler {
...
@@ -90,6 +92,7 @@ namespace scheduler {
namespace
detail
{
namespace
detail
{
class
logging
;
class
logging
;
class
disposer
;
class
singletons
;
class
singletons
;
class
message_data
;
class
message_data
;
class
group_manager
;
class
group_manager
;
...
@@ -97,6 +100,8 @@ namespace detail {
...
@@ -97,6 +100,8 @@ namespace detail {
class
uniform_type_info_map
;
class
uniform_type_info_map
;
}
// namespace detail
}
// namespace detail
using
mailbox_element_ptr
=
std
::
unique_ptr
<
mailbox_element
,
detail
::
disposer
>
;
}
// namespace caf
}
// namespace caf
#endif // CAF_FWD_HPP
#endif // CAF_FWD_HPP
libcaf_core/caf/local_actor.hpp
View file @
ade02937
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
#include "caf/mixin/memory_cached.hpp"
#include "caf/mixin/memory_cached.hpp"
#include "caf/detail/logging.hpp"
#include "caf/detail/logging.hpp"
#include "caf/detail/disposer.hpp"
#include "caf/detail/behavior_stack.hpp"
#include "caf/detail/behavior_stack.hpp"
#include "caf/detail/typed_actor_util.hpp"
#include "caf/detail/typed_actor_util.hpp"
#include "caf/detail/single_reader_queue.hpp"
#include "caf/detail/single_reader_queue.hpp"
...
...
libcaf_core/caf/mailbox_element.hpp
View file @
ade02937
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
#include "caf/mixin/memory_cached.hpp"
#include "caf/mixin/memory_cached.hpp"
#include "caf/detail/disposer.hpp"
namespace
caf
{
namespace
caf
{
class
mailbox_element
:
public
extend
<
memory_managed
>::
class
mailbox_element
:
public
extend
<
memory_managed
>::
...
...
libcaf_core/caf/memory_managed.hpp
View file @
ade02937
...
@@ -22,10 +22,6 @@
...
@@ -22,10 +22,6 @@
namespace
caf
{
namespace
caf
{
namespace
detail
{
struct
disposer
;
}
/**
/**
* This base enables derived classes to enforce a different
* This base enables derived classes to enforce a different
* allocation strategy than new/delete by providing a virtual
* allocation strategy than new/delete by providing a virtual
...
@@ -33,8 +29,6 @@ struct disposer;
...
@@ -33,8 +29,6 @@ struct disposer;
*/
*/
class
memory_managed
{
class
memory_managed
{
public:
public:
friend
struct
detail
::
disposer
;
/**
/**
* Default implementations calls `delete this, but can
* Default implementations calls `delete this, but can
* be overriden in case deletion depends on some condition or
* be overriden in case deletion depends on some condition or
...
...
libcaf_io/caf/io/network/multiplexer.hpp
View file @
ade02937
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "caf/mixin/memory_cached.hpp"
#include "caf/mixin/memory_cached.hpp"
#include "caf/detail/memory.hpp"
#include "caf/detail/memory.hpp"
#include "caf/detail/disposer.hpp"
namespace
boost
{
namespace
boost
{
namespace
asio
{
namespace
asio
{
...
...
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