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
b9765f33
Commit
b9765f33
authored
Dec 04, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up code in producer_consumer_list
parent
fb372b13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
cppa/util/producer_consumer_list.hpp
cppa/util/producer_consumer_list.hpp
+10
-13
No files found.
cppa/util/producer_consumer_list.hpp
View file @
b9765f33
...
...
@@ -116,18 +116,6 @@ class producer_consumer_list {
std
::
atomic
<
bool
>
m_consumer_lock
;
std
::
atomic
<
bool
>
m_producer_lock
;
void
push_impl
(
node
*
tmp
)
{
// acquire exclusivity
while
(
m_producer_lock
.
exchange
(
true
))
{
std
::
this_thread
::
yield
();
}
// publish & swing last forward
m_last
->
next
=
tmp
;
m_last
=
tmp
;
// release exclusivity
m_producer_lock
=
false
;
}
public:
producer_consumer_list
()
{
...
...
@@ -146,7 +134,16 @@ class producer_consumer_list {
inline
void
push_back
(
pointer
value
)
{
assert
(
value
!=
nullptr
);
push_impl
(
new
node
(
value
));
node
*
tmp
=
new
node
(
value
);
// acquire exclusivity
while
(
m_producer_lock
.
exchange
(
true
))
{
std
::
this_thread
::
yield
();
}
// publish & swing last forward
m_last
->
next
=
tmp
;
m_last
=
tmp
;
// release exclusivity
m_producer_lock
=
false
;
}
// returns nullptr on failure
...
...
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