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
typon
typon-concurrency
Commits
badc9889
Commit
badc9889
authored
May 19, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc.hpp: Start with initial bogus node
parent
34223445
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
rt/include/typon/fundamental/gc.hpp
rt/include/typon/fundamental/gc.hpp
+7
-12
No files found.
rt/include/typon/fundamental/gc.hpp
View file @
badc9889
...
...
@@ -50,13 +50,16 @@ namespace typon::fdt::lock_free
const
uint
_concurrency
;
std
::
atomic
<
u64
>
*
const
_stamps
;
std
::
atomic
<
u64
>
_stamp
{
0
};
std
::
atomic
<
node
*>
_head
{
nullptr
}
;
std
::
atomic
<
node
*>
_tail
{
nullptr
}
;
std
::
atomic
<
node
*>
_head
;
std
::
atomic
<
node
*>
_tail
;
gc
(
uint
concurrency
)
noexcept
:
_concurrency
(
concurrency
)
,
_stamps
(
new
std
::
atomic
<
u64
>
[
concurrency
])
{
auto
first
=
new
node
(
0
);
_head
.
store
(
first
);
_tail
.
store
(
first
);
for
(
uint
i
=
0
;
i
<
_concurrency
;
i
++
)
{
_stamps
[
i
].
store
(
u64
(
-
1
));
...
...
@@ -74,14 +77,7 @@ namespace typon::fdt::lock_free
auto
stamp
=
_stamp
.
load
();
auto
node
=
new
garbage
<
T
>
{
ptr
,
stamp
};
auto
head
=
_head
.
exchange
(
node
);
if
(
head
)
{
head
->
_next
.
store
(
node
);
}
else
{
_tail
.
store
(
node
);
}
head
->
_next
.
store
(
node
);
}
void
leave
(
uint
id
)
noexcept
...
...
@@ -110,7 +106,7 @@ namespace typon::fdt::lock_free
void
reclaim
(
u64
oldest
)
noexcept
{
auto
tail
=
_tail
.
load
();
while
(
t
ail
)
while
(
t
rue
)
{
if
(
tail
->
_stamp
>=
oldest
)
{
...
...
@@ -141,7 +137,6 @@ namespace typon::fdt::lock_free
}
}
};
}
...
...
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