Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
cython-plus
typon
Commits
08e092ba
Commit
08e092ba
authored
May 07, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deque.hpp atomics bug introduced in refactor
parent
c24453b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
rt/include/typon/fundamental/deque.hpp
rt/include/typon/fundamental/deque.hpp
+14
-13
No files found.
rt/include/typon/fundamental/deque.hpp
View file @
08e092ba
...
...
@@ -64,23 +64,24 @@ namespace typon::fdt::lock_free
_bottom
.
store
(
bottom
,
relaxed
);
std
::
atomic_thread_fence
(
seq_cst
);
u64
top
=
_top
.
load
(
relaxed
);
if
(
top
>
bottom
)
pop_type
x
{
Empty
};
if
(
top
<=
bottom
)
{
_bottom
.
store
(
top
,
relaxed
);
return
{
Empty
};
}
T
x
=
array
->
get
(
bottom
);
if
(
top
<
bottom
)
{
return
{
x
};
x
=
array
->
get
(
bottom
);
if
(
top
==
bottom
)
{
if
(
!
_top
.
compare_exchange_strong
(
top
,
top
+
1
,
seq_cst
,
relaxed
))
{
x
=
{
Empty
};
}
_bottom
.
store
(
bottom
+
1
,
relaxed
);
}
}
bool
win
=
_top
.
compare_exchange_strong
(
top
,
top
+
1
,
seq_cst
,
relaxed
);
_bottom
.
store
(
top
+
1
,
relaxed
);
if
(
win
)
else
{
return
{
x
}
;
_bottom
.
store
(
bottom
+
1
,
relaxed
)
;
}
return
{
Empty
}
;
return
x
;
}
pop_type
steal
()
noexcept
...
...
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