mirror of
https://github.com/odin-lang/Odin.git
synced 2026-10-08 05:48:51 -04:00
Use relaxed ordering for nbio's mpsc head counter and pool's destroy exchange, as their acquire paired with nothing
This commit is contained in:
1 parent
b12195bebf
commit
7571a2676f
2 files changed
+2
-2
No files matched your search
@@ -48,7 +48,7 @@ init :: proc(p: ^Pool($T), $link_field: string, block_size: uint = DEFAULT_BLOCK
|
||||
}
|
||||
|
||||
destroy :: proc(p: ^Pool($T)) {
|
||||
elem := sync.atomic_exchange_explicit(&p.free_list, nil, .Acquire)
|
||||
elem := sync.atomic_exchange_explicit(&p.free_list, nil, .Relaxed)
|
||||
|
||||
sync.atomic_store_explicit(&p.num_ready, 0, .Relaxed)
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ mpsc_enqueue :: proc(mpscq: ^Multi_Producer_Single_Consumer, obj: rawptr) -> boo
|
||||
return false
|
||||
}
|
||||
|
||||
head := sync.atomic_add_explicit(&mpscq.head, 1, .Acquire)
|
||||
head := sync.atomic_add_explicit(&mpscq.head, 1, .Relaxed)
|
||||
assert(mpscq.buffer[head & mpscq.mask] == nil)
|
||||
rv := sync.atomic_exchange_explicit(&mpscq.buffer[head & mpscq.mask], obj, .Release)
|
||||
assert(rv == nil)
|
||||
|
||||
Reference in new issue
Block a user