Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-concurrency
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
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
Xavier Thompson
typon-concurrency
Commits
4f67c5a3
Commit
4f67c5a3
authored
Jun 20, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve event_count.hpp
parent
663bf85b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
rt/include/typon/fundamental/event_count.hpp
rt/include/typon/fundamental/event_count.hpp
+8
-10
No files found.
rt/include/typon/fundamental/event_count.hpp
View file @
4f67c5a3
...
@@ -22,25 +22,23 @@ namespace typon::fdt::lock_free
...
@@ -22,25 +22,23 @@ namespace typon::fdt::lock_free
auto
prepare_wait
()
noexcept
auto
prepare_wait
()
noexcept
{
{
return
_state
.
fetch_add
(
1
,
std
::
memory_order_acq_rel
);
return
_state
.
load
(
std
::
memory_order_acquire
);
}
}
void
cancel_wait
()
noexcept
void
cancel_wait
()
noexcept
{}
{
_state
.
fetch_sub
(
1
,
std
::
memory_order_seq_cst
);
}
void
wait
(
u64
state
)
noexcept
void
wait
(
u64
key
)
noexcept
{
{
u64
state
=
_state
.
fetch_add
(
1
,
std
::
memory_order_acq_rel
)
+
1
;
for
(;;)
for
(;;)
{
{
_state
.
wait
(
state
,
std
::
memory_order_acquire
);
if
((
state
^
key
)
&
(
~
mask
))
auto
newstate
=
_state
.
load
(
std
::
memory_order_acquire
);
if
((
newstate
^
state
)
&
(
~
mask
))
{
{
break
;
break
;
}
}
state
=
newstate
;
key
=
state
;
_state
.
wait
(
key
,
std
::
memory_order_acquire
);
state
=
_state
.
load
(
std
::
memory_order_acquire
);
}
}
_state
.
fetch_sub
(
1
,
std
::
memory_order_seq_cst
);
_state
.
fetch_sub
(
1
,
std
::
memory_order_seq_cst
);
}
}
...
...
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