github.com/afumu/libc@v0.0.6/sync.go (about)

     1  // Copyright 2021 The Libc Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package libc // import "github.com/afumu/libc"
     6  
     7  import (
     8  	"sync/atomic"
     9  )
    10  
    11  var __sync_synchronize_dummy int32
    12  
    13  // __sync_synchronize();
    14  func X__sync_synchronize(t *TLS) {
    15  	// Attempt to implement a full memory barrier without assembler.
    16  	atomic.StoreInt32(&__sync_synchronize_dummy, atomic.LoadInt32(&__sync_synchronize_dummy)+1)
    17  }