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
5f7f7633
Commit
5f7f7633
authored
Aug 27, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make `intrusive_ptr` compatible to boost version
parent
64cff1d0
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
18 deletions
+24
-18
libcaf_core/caf/detail/memory.hpp
libcaf_core/caf/detail/memory.hpp
+1
-1
libcaf_core/caf/detail/message_data.hpp
libcaf_core/caf/detail/message_data.hpp
+6
-6
libcaf_core/caf/intrusive_ptr.hpp
libcaf_core/caf/intrusive_ptr.hpp
+9
-3
libcaf_core/caf/match_case.hpp
libcaf_core/caf/match_case.hpp
+2
-2
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+2
-2
libcaf_core/src/message_builder.cpp
libcaf_core/src/message_builder.cpp
+2
-2
libcaf_core/src/message_data.cpp
libcaf_core/src/message_data.cpp
+1
-1
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+1
-1
No files found.
libcaf_core/caf/detail/memory.hpp
View file @
5f7f7633
...
@@ -171,7 +171,7 @@ public:
...
@@ -171,7 +171,7 @@ public:
// we got the last element out of the cache; pass the reference to the
// we got the last element out of the cache; pass the reference to the
// client to avoid pointless increase/decrease ops on the reference count
// client to avoid pointless increase/decrease ops on the reference count
embedded_storage
result
;
embedded_storage
result
;
result
.
first
.
reset
(
cache_
.
release
(),
false
);
result
.
first
.
reset
(
cache_
.
detach
(),
false
);
result
.
second
=
res
;
result
.
second
=
res
;
return
result
;
return
result
;
}
}
...
...
libcaf_core/caf/detail/message_data.hpp
View file @
5f7f7633
...
@@ -105,19 +105,19 @@ public:
...
@@ -105,19 +105,19 @@ public:
}
}
inline
message_data
*
release
()
{
inline
message_data
*
release
()
{
return
ptr_
.
release
();
return
ptr_
.
detach
();
}
}
inline
void
detach
()
{
inline
void
unshare
()
{
static_cast
<
void
>
(
get_
detach
ed
());
static_cast
<
void
>
(
get_
unshar
ed
());
}
}
inline
message_data
*
operator
->
()
{
inline
message_data
*
operator
->
()
{
return
get_
detach
ed
();
return
get_
unshar
ed
();
}
}
inline
message_data
&
operator
*
()
{
inline
message_data
&
operator
*
()
{
return
*
get_
detach
ed
();
return
*
get_
unshar
ed
();
}
}
/**************************************************************************
/**************************************************************************
* observers *
* observers *
...
@@ -140,7 +140,7 @@ public:
...
@@ -140,7 +140,7 @@ public:
}
}
private:
private:
message_data
*
get_
detach
ed
();
message_data
*
get_
unshar
ed
();
intrusive_ptr
<
message_data
>
ptr_
;
intrusive_ptr
<
message_data
>
ptr_
;
};
};
...
...
libcaf_core/caf/intrusive_ptr.hpp
View file @
5f7f7633
...
@@ -51,7 +51,7 @@ public:
...
@@ -51,7 +51,7 @@ public:
set_ptr
(
raw_ptr
,
add_ref
);
set_ptr
(
raw_ptr
,
add_ref
);
}
}
intrusive_ptr
(
intrusive_ptr
&&
other
)
:
ptr_
(
other
.
release
())
{
intrusive_ptr
(
intrusive_ptr
&&
other
)
:
ptr_
(
other
.
detach
())
{
// nop
// nop
}
}
...
@@ -60,7 +60,7 @@ public:
...
@@ -60,7 +60,7 @@ public:
}
}
template
<
class
Y
>
template
<
class
Y
>
intrusive_ptr
(
intrusive_ptr
<
Y
>
other
)
:
ptr_
(
other
.
release
())
{
intrusive_ptr
(
intrusive_ptr
<
Y
>
other
)
:
ptr_
(
other
.
detach
())
{
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
static_assert
(
std
::
is_convertible
<
Y
*
,
T
*>::
value
,
"Y* is not assignable to T*"
);
"Y* is not assignable to T*"
);
}
}
...
@@ -77,12 +77,18 @@ public:
...
@@ -77,12 +77,18 @@ public:
/// Returns the raw pointer without modifying reference
/// Returns the raw pointer without modifying reference
/// count and sets this to `nullptr`.
/// count and sets this to `nullptr`.
pointer
release
()
noexcept
{
pointer
detach
()
noexcept
{
auto
result
=
ptr_
;
auto
result
=
ptr_
;
ptr_
=
nullptr
;
ptr_
=
nullptr
;
return
result
;
return
result
;
}
}
/// Returns the raw pointer without modifying reference
/// count and sets this to `nullptr`.
pointer
release
()
noexcept
{
return
detach
();
}
void
reset
(
pointer
new_value
=
nullptr
,
bool
add_ref
=
true
)
{
void
reset
(
pointer
new_value
=
nullptr
,
bool
add_ref
=
true
)
{
auto
old
=
ptr_
;
auto
old
=
ptr_
;
set_ptr
(
new_value
,
add_ref
);
set_ptr
(
new_value
,
add_ref
);
...
...
libcaf_core/caf/match_case.hpp
View file @
5f7f7633
...
@@ -201,7 +201,7 @@ public:
...
@@ -201,7 +201,7 @@ public:
}
}
// detach msg before invoking fun_ if needed
// detach msg before invoking fun_ if needed
if
(
is_manipulator
)
{
if
(
is_manipulator
)
{
msg
.
force_
detach
();
msg
.
force_
unshare
();
// update pointers in our intermediate tuple
// update pointers in our intermediate tuple
for
(
size_t
i
=
0
;
i
<
msg
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
msg
.
size
();
++
i
)
{
// msg is guaranteed to be detached, hence we don't need to
// msg is guaranteed to be detached, hence we don't need to
...
@@ -369,7 +369,7 @@ public:
...
@@ -369,7 +369,7 @@ public:
bool
prepare_invoke
(
message
&
msg
,
Tuple
*
out
)
{
bool
prepare_invoke
(
message
&
msg
,
Tuple
*
out
)
{
// detach msg before invoking fun_ if needed
// detach msg before invoking fun_ if needed
if
(
detail
::
tl_exists
<
fargs
,
detail
::
is_mutable_ref
>::
value
)
{
if
(
detail
::
tl_exists
<
fargs
,
detail
::
is_mutable_ref
>::
value
)
{
msg
.
force_
detach
();
msg
.
force_
unshare
();
}
}
using
filtered_pattern
=
using
filtered_pattern
=
typename
detail
::
tl_filter_not_type
<
typename
detail
::
tl_filter_not_type
<
...
...
libcaf_core/caf/message.hpp
View file @
5f7f7633
...
@@ -281,8 +281,8 @@ public:
...
@@ -281,8 +281,8 @@ public:
return
vals_
?
vals_
->
type_token
()
:
0xFFFFFFFF
;
return
vals_
?
vals_
->
type_token
()
:
0xFFFFFFFF
;
}
}
inline
void
force_
detach
()
{
inline
void
force_
unshare
()
{
vals_
.
detach
();
vals_
.
unshare
();
}
}
void
reset
(
raw_ptr
new_ptr
=
nullptr
,
bool
add_ref
=
true
);
void
reset
(
raw_ptr
new_ptr
=
nullptr
,
bool
add_ref
=
true
);
...
...
libcaf_core/src/message_builder.cpp
View file @
5f7f7633
...
@@ -156,7 +156,7 @@ message message_builder::to_message() const {
...
@@ -156,7 +156,7 @@ message message_builder::to_message() const {
message
message_builder
::
move_to_message
()
{
message
message_builder
::
move_to_message
()
{
message
result
;
message
result
;
result
.
vals
().
reset
(
static_cast
<
dynamic_msg_data
*>
(
data_
.
release
()),
false
);
result
.
vals
().
reset
(
static_cast
<
dynamic_msg_data
*>
(
data_
.
detach
()),
false
);
return
result
;
return
result
;
}
}
...
@@ -164,7 +164,7 @@ optional<message> message_builder::apply(message_handler handler) {
...
@@ -164,7 +164,7 @@ optional<message> message_builder::apply(message_handler handler) {
// avoid detaching of data_ by moving the data to a message object,
// avoid detaching of data_ by moving the data to a message object,
// calling message::apply and moving the data back
// calling message::apply and moving the data back
message
::
data_ptr
ptr
;
message
::
data_ptr
ptr
;
ptr
.
reset
(
static_cast
<
dynamic_msg_data
*>
(
data_
.
release
()),
false
);
ptr
.
reset
(
static_cast
<
dynamic_msg_data
*>
(
data_
.
detach
()),
false
);
message
msg
{
std
::
move
(
ptr
)};
message
msg
{
std
::
move
(
ptr
)};
auto
res
=
msg
.
apply
(
std
::
move
(
handler
));
auto
res
=
msg
.
apply
(
std
::
move
(
handler
));
data_
.
reset
(
msg
.
vals
().
release
(),
false
);
data_
.
reset
(
msg
.
vals
().
release
(),
false
);
...
...
libcaf_core/src/message_data.cpp
View file @
5f7f7633
...
@@ -65,7 +65,7 @@ std::string message_data::tuple_type_names() const {
...
@@ -65,7 +65,7 @@ std::string message_data::tuple_type_names() const {
return
result
;
return
result
;
}
}
message_data
*
message_data
::
cow_ptr
::
get_
detach
ed
()
{
message_data
*
message_data
::
cow_ptr
::
get_
unshar
ed
()
{
auto
p
=
ptr_
.
get
();
auto
p
=
ptr_
.
get
();
if
(
!
p
->
unique
())
{
if
(
!
p
->
unique
())
{
auto
cptr
=
p
->
copy
();
auto
cptr
=
p
->
copy
();
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
5f7f7633
...
@@ -727,7 +727,7 @@ default_multiplexer::~default_multiplexer() {
...
@@ -727,7 +727,7 @@ default_multiplexer::~default_multiplexer() {
}
}
void
default_multiplexer
::
dispatch_runnable
(
runnable_ptr
ptr
)
{
void
default_multiplexer
::
dispatch_runnable
(
runnable_ptr
ptr
)
{
wr_dispatch_request
(
ptr
.
release
());
wr_dispatch_request
(
ptr
.
detach
());
}
}
connection_handle
default_multiplexer
::
add_tcp_scribe
(
abstract_broker
*
self
,
connection_handle
default_multiplexer
::
add_tcp_scribe
(
abstract_broker
*
self
,
...
...
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