mirror of
https://github.com/ii64/gouring.git
synced 2025-04-01 03:41:44 +02:00
feat: seq_cst implementation
This commit is contained in:
parent
527c11cde6
commit
1abd875eb9
3 changed files with 27 additions and 1 deletions
13
atomic.go
Normal file
13
atomic.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package gouring
|
||||
|
||||
import _ "unsafe"
|
||||
|
||||
var io_uring_smp_mb = io_uring_smp_mb_fallback
|
||||
|
||||
func io_uring_smp_mb_fallback()
|
||||
func io_uring_smp_mb_mfence()
|
||||
|
||||
func init() {
|
||||
// temporary
|
||||
io_uring_smp_mb = io_uring_smp_mb_mfence
|
||||
}
|
12
atomic_amd64.s
Normal file
12
atomic_amd64.s
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "go_asm.h"
|
||||
#include "funcdata.h"
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·io_uring_smp_mb_fallback(SB), NOSPLIT, $0
|
||||
LOCK
|
||||
ORQ $0, 0(SP)
|
||||
RET
|
||||
|
||||
TEXT ·io_uring_smp_mb_mfence(SB), NOSPLIT, $0
|
||||
MFENCE
|
||||
RET
|
3
queue.go
3
queue.go
|
@ -19,7 +19,8 @@ func (ring *IoUring) sq_ring_needs_enter(flags *uint32) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// FIXME: io_uring_smp_mb
|
||||
// FIXME: Extra call - no inline asm.
|
||||
io_uring_smp_mb()
|
||||
|
||||
if atomic.LoadUint32(ring.Sq._Flags())&IORING_SQ_NEED_WAKEUP != 0 {
|
||||
*flags |= IORING_ENTER_SQ_WAKEUP
|
||||
|
|
Loading…
Add table
Reference in a new issue