github.com/moontrade/unsafe@v0.9.1/cgo/call.go (about)

     1  //go:build !libfuzzer && !tinygo && (amd64 || arm64) && (linux || darwin)
     2  
     3  package cgo
     4  
     5  import "github.com/moontrade/unsafe/cgo/internal/trampoline"
     6  
     7  // NonBlocking C function fn without going all the way through cgo
     8  // Be very careful using it. If the C code blocks it can/will
     9  // lock up your app.
    10  // Example: NonBlocking((*byte)(C.my_c_func), 0, 0)
    11  //
    12  //	void my_c_func(size_t arg0, size_t arg1) {
    13  //	}
    14  //
    15  //go:nosplit
    16  //go:noescape
    17  func NonBlocking(fn *byte, arg0, arg1 uintptr)
    18  
    19  func Blocking(fn *byte, arg0, arg1 uintptr) {
    20  	trampoline.Blocking(fn, arg0, arg1)
    21  }