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
4166b8e1
Commit
4166b8e1
authored
Jul 05, 2017
by
Etienne Baratte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix local_group::erase_subscriber
parent
4836d709
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
libcaf_core/caf/intrusive_ptr.hpp
libcaf_core/caf/intrusive_ptr.hpp
+11
-0
libcaf_core/src/group_manager.cpp
libcaf_core/src/group_manager.cpp
+13
-5
No files found.
libcaf_core/caf/intrusive_ptr.hpp
View file @
4166b8e1
...
@@ -232,6 +232,17 @@ bool operator<(const intrusive_ptr<T>& x, const intrusive_ptr<T>& y) {
...
@@ -232,6 +232,17 @@ bool operator<(const intrusive_ptr<T>& x, const intrusive_ptr<T>& y) {
return
x
.
get
()
<
y
.
get
();
return
x
.
get
()
<
y
.
get
();
}
}
/// @relates intrusive_ptr
template
<
class
T
>
bool
operator
<
(
const
intrusive_ptr
<
T
>&
x
,
const
T
*
y
)
{
return
x
.
get
()
<
y
;
}
/// @relates intrusive_ptr
template
<
class
T
>
bool
operator
<
(
const
T
*
x
,
const
intrusive_ptr
<
T
>&
y
)
{
return
x
<
y
.
get
();
}
template
<
class
T
>
template
<
class
T
>
std
::
string
to_string
(
const
intrusive_ptr
<
T
>&
x
)
{
std
::
string
to_string
(
const
intrusive_ptr
<
T
>&
x
)
{
auto
v
=
reinterpret_cast
<
uintptr_t
>
(
x
.
get
());
auto
v
=
reinterpret_cast
<
uintptr_t
>
(
x
.
get
());
...
...
libcaf_core/src/group_manager.cpp
View file @
4166b8e1
...
@@ -87,12 +87,16 @@ public:
...
@@ -87,12 +87,16 @@ public:
std
::
pair
<
bool
,
size_t
>
erase_subscriber
(
const
actor_control_block
*
who
)
{
std
::
pair
<
bool
,
size_t
>
erase_subscriber
(
const
actor_control_block
*
who
)
{
CAF_LOG_TRACE
(
""
);
// serializing who would cause a deadlock
CAF_LOG_TRACE
(
""
);
// serializing who would cause a deadlock
exclusive_guard
guard
(
mtx_
);
exclusive_guard
guard
(
mtx_
);
auto
cmp
=
[](
const
strong_actor_ptr
&
lhs
,
const
actor_control_block
*
rhs
)
{
return
actor_addr
::
compare
(
lhs
.
get
(),
rhs
)
<
0
;
};
auto
e
=
subscribers_
.
end
();
auto
e
=
subscribers_
.
end
();
auto
i
=
std
::
lower_bound
(
subscribers_
.
begin
(),
e
,
who
,
cmp
);
#if __cplusplus > 201103L
if
(
i
==
e
||
actor_addr
::
compare
(
i
->
get
(),
who
)
!=
0
)
auto
i
=
subscribers_
.
find
(
who
);
#else
auto
cmp
=
[
&
](
const
strong_actor_ptr
&
lhs
)
{
return
lhs
.
get
()
==
who
;
};
auto
i
=
std
::
find_if
(
subscribers_
.
begin
(),
e
,
cmp
);
#endif
if
(
i
==
e
)
return
{
false
,
subscribers_
.
size
()};
return
{
false
,
subscribers_
.
size
()};
subscribers_
.
erase
(
i
);
subscribers_
.
erase
(
i
);
return
{
true
,
subscribers_
.
size
()};
return
{
true
,
subscribers_
.
size
()};
...
@@ -126,7 +130,11 @@ public:
...
@@ -126,7 +130,11 @@ public:
protected:
protected:
detail
::
shared_spinlock
mtx_
;
detail
::
shared_spinlock
mtx_
;
#if __cplusplus > 201103L
std
::
set
<
strong_actor_ptr
,
std
::
less
<>>
subscribers_
;
#else
std
::
set
<
strong_actor_ptr
>
subscribers_
;
std
::
set
<
strong_actor_ptr
>
subscribers_
;
#endif
actor
broker_
;
actor
broker_
;
};
};
...
...
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