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
e1a21a76
Commit
e1a21a76
authored
Oct 12, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
got rid of legacy ref_counted_impl
parent
172a53f4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
42 deletions
+16
-42
cppa.files
cppa.files
+1
-1
cppa/on.hpp
cppa/on.hpp
+0
-1
cppa/ref_counted.hpp
cppa/ref_counted.hpp
+9
-10
src/ref_counted.cpp
src/ref_counted.cpp
+4
-27
unit_testing/test__intrusive_ptr.cpp
unit_testing/test__intrusive_ptr.cpp
+2
-3
No files found.
cppa.files
View file @
e1a21a76
...
...
@@ -63,7 +63,6 @@ cppa/detail/pseudo_tuple.hpp
cppa/detail/ptype_to_type.hpp
cppa/detail/receive_loop_helper.hpp
cppa/detail/recursive_queue_node.hpp
cppa/detail/ref_counted_impl.hpp
cppa/detail/scheduled_actor_dummy.hpp
cppa/detail/serialize_tuple.hpp
cppa/detail/singleton_manager.hpp
...
...
@@ -280,3 +279,4 @@ cppa/network/default_peer_impl.hpp
src/default_peer_impl.cpp
cppa/network/default_peer_acceptor_impl.hpp
src/default_peer_acceptor_impl.cpp
src/ref_counted.cpp
cppa/on.hpp
View file @
e1a21a76
...
...
@@ -52,7 +52,6 @@
#include "cppa/detail/boxed.hpp"
#include "cppa/detail/unboxed.hpp"
#include "cppa/detail/value_guard.hpp"
#include "cppa/detail/ref_counted_impl.hpp"
#include "cppa/detail/implicit_conversions.hpp"
namespace
cppa
{
namespace
detail
{
...
...
cppa/ref_counted.hpp
View file @
e1a21a76
...
...
@@ -34,11 +34,8 @@
#include <atomic>
#include <cstddef>
#include "cppa/detail/ref_counted_impl.hpp"
namespace
cppa
{
#ifdef CPPA_DOCUMENTATION
/**
* @brief A (thread safe) base class for reference counted objects
...
...
@@ -51,31 +48,33 @@ class ref_counted {
public:
inline
ref_counted
()
:
m_rc
(
0
)
{
}
/**
* @brief Increases reference count by one.
*/
void
ref
();
inline
void
ref
()
{
++
m_rc
;
}
/**
* @brief Decreases reference cound by one.
* @returns @p true if there are still references to this object
* (reference count > 0); otherwise @p false.
*/
bool
deref
();
inline
bool
deref
()
{
return
--
m_rc
>
0
;
}
/**
* @brief Queries if there is exactly one reference.
* @returns @p true if reference count is one; otherwise @p false.
*/
bool
unique
();
inline
bool
unique
()
{
return
m_rc
==
1
;
}
}
;
virtual
~
ref_counted
()
;
#else
private:
typedef
detail
::
ref_counted_impl
<
std
::
atomic
<
size_t
>
>
ref_counted
;
std
::
atomic
<
size_t
>
m_rc
;
#endif
};
}
// namespace cppa
...
...
cppa/detail/ref_counted_impl.h
pp
→
src/ref_counted.c
pp
View file @
e1a21a76
...
...
@@ -28,34 +28,11 @@
\******************************************************************************/
#ifndef CPPA_REF_COUNTED_IMPL_HPP
#define CPPA_REF_COUNTED_IMPL_HPP
namespace
cppa
{
namespace
detail
{
#include "cppa/ref_counted.hpp"
template
<
typename
T
>
class
ref_counted_impl
{
namespace
cppa
{
T
m_rc
;
ref_counted
::~
ref_counted
()
{
}
ref_counted_impl
(
const
ref_counted_impl
&
)
=
delete
;
ref_counted_impl
&
operator
=
(
const
ref_counted_impl
&
)
=
delete
;
public:
virtual
~
ref_counted_impl
()
{
}
inline
ref_counted_impl
()
:
m_rc
(
0
)
{
}
inline
void
ref
()
{
++
m_rc
;
}
inline
bool
deref
()
{
return
--
m_rc
>
0
;
}
inline
bool
unique
()
{
return
m_rc
==
1
;
}
};
}
}
// namespace cppa::detail
#endif // CPPA_REF_COUNTED_IMPL_HPP
}
// namespace cppa
unit_testing/test__intrusive_ptr.cpp
View file @
e1a21a76
...
...
@@ -2,10 +2,9 @@
#include <cstddef>
#include "test.hpp"
#include "cppa/ref_counted.hpp"
#include "cppa/intrusive_ptr.hpp"
#include "cppa/detail/ref_counted_impl.hpp"
using
namespace
cppa
;
namespace
{
...
...
@@ -15,7 +14,7 @@ int class1_instances = 0;
}
struct
class0
:
cppa
::
detail
::
ref_counted_impl
<
size_t
>
{
struct
class0
:
ref_counted
{
class0
()
{
++
class0_instances
;
}
virtual
~
class0
()
{
--
class0_instances
;
}
...
...
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