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
f793d7ed
Commit
f793d7ed
authored
Jun 26, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable intrusive_ptr<const T>
parent
eb1cc7b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
libcaf_core/caf/memory_managed.hpp
libcaf_core/caf/memory_managed.hpp
+1
-1
libcaf_core/caf/ref_counted.hpp
libcaf_core/caf/ref_counted.hpp
+5
-5
libcaf_core/src/memory_managed.cpp
libcaf_core/src/memory_managed.cpp
+1
-1
libcaf_core/src/ref_counted.cpp
libcaf_core/src/ref_counted.cpp
+1
-1
No files found.
libcaf_core/caf/memory_managed.hpp
View file @
f793d7ed
...
@@ -32,7 +32,7 @@ public:
...
@@ -32,7 +32,7 @@ public:
/// reference of this object before calling this member
/// reference of this object before calling this member
/// function. This information is important when
/// function. This information is important when
/// implementing a type with support for weak pointers.
/// implementing a type with support for weak pointers.
virtual
void
request_deletion
(
bool
decremented_rc
)
noexcept
;
virtual
void
request_deletion
(
bool
decremented_rc
)
const
noexcept
;
protected:
protected:
virtual
~
memory_managed
();
virtual
~
memory_managed
();
...
...
libcaf_core/caf/ref_counted.hpp
View file @
f793d7ed
...
@@ -38,13 +38,13 @@ public:
...
@@ -38,13 +38,13 @@ public:
ref_counted
&
operator
=
(
const
ref_counted
&
);
ref_counted
&
operator
=
(
const
ref_counted
&
);
/// Increases reference count by one.
/// Increases reference count by one.
inline
void
ref
()
noexcept
{
inline
void
ref
()
const
noexcept
{
rc_
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
rc_
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
}
}
/// Decreases reference count by one and calls `request_deletion`
/// Decreases reference count by one and calls `request_deletion`
/// when it drops to zero.
/// when it drops to zero.
void
deref
()
noexcept
;
void
deref
()
const
noexcept
;
/// Queries whether there is exactly one reference.
/// Queries whether there is exactly one reference.
inline
bool
unique
()
const
noexcept
{
inline
bool
unique
()
const
noexcept
{
...
@@ -56,16 +56,16 @@ public:
...
@@ -56,16 +56,16 @@ public:
}
}
protected:
protected:
std
::
atomic
<
size_t
>
rc_
;
mutable
std
::
atomic
<
size_t
>
rc_
;
};
};
/// @relates ref_counted
/// @relates ref_counted
inline
void
intrusive_ptr_add_ref
(
ref_counted
*
p
)
{
inline
void
intrusive_ptr_add_ref
(
const
ref_counted
*
p
)
{
p
->
ref
();
p
->
ref
();
}
}
/// @relates ref_counted
/// @relates ref_counted
inline
void
intrusive_ptr_release
(
ref_counted
*
p
)
{
inline
void
intrusive_ptr_release
(
const
ref_counted
*
p
)
{
p
->
deref
();
p
->
deref
();
}
}
...
...
libcaf_core/src/memory_managed.cpp
View file @
f793d7ed
...
@@ -24,7 +24,7 @@ memory_managed::~memory_managed() {
...
@@ -24,7 +24,7 @@ memory_managed::~memory_managed() {
// nop
// nop
}
}
void
memory_managed
::
request_deletion
(
bool
)
noexcept
{
void
memory_managed
::
request_deletion
(
bool
)
const
noexcept
{
delete
this
;
delete
this
;
}
}
...
...
libcaf_core/src/ref_counted.cpp
View file @
f793d7ed
...
@@ -37,7 +37,7 @@ ref_counted& ref_counted::operator=(const ref_counted&) {
...
@@ -37,7 +37,7 @@ ref_counted& ref_counted::operator=(const ref_counted&) {
return
*
this
;
return
*
this
;
}
}
void
ref_counted
::
deref
()
noexcept
{
void
ref_counted
::
deref
()
const
noexcept
{
if
(
unique
())
{
if
(
unique
())
{
request_deletion
(
false
);
request_deletion
(
false
);
return
;
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