Documentation
¶
Overview ¶
Package gointerop provides Go concurrency primitive wrappers.
Channels ¶
- make-channel, channel?
- channel-send!, channel-receive
- channel-try-send!, channel-try-receive
- channel-close!
Wait Groups ¶
- make-wait-group, wait-group?
- wait-group-add!, wait-group-done!
- wait-group-wait!
Read-Write Mutexes ¶
- make-rw-mutex, rw-mutex?
- rw-mutex-lock!, rw-mutex-unlock!
- rw-mutex-rlock!, rw-mutex-runlock!
Once ¶
- make-once, once?
- once-do!
Atomics ¶
- make-atomic, atomic?
- atomic-load, atomic-store!, atomic-swap!, atomic-cas!
- make-atomic-int64, atomic-int64?
- atomic-int64-load, atomic-int64-store!, atomic-int64-add!
Use Extension or AddToRegistry to register all primitives.
Package gointerop provides Go-specific concurrency primitives.
Index ¶
- Variables
- func PrimAtomicCompareAndSwap(_ context.Context, mc *machine.MachineContext) error
- func PrimAtomicLoad(_ context.Context, mc *machine.MachineContext) error
- func PrimAtomicQ(_ context.Context, mc *machine.MachineContext) error
- func PrimAtomicStore(_ context.Context, mc *machine.MachineContext) error
- func PrimAtomicSwap(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelCapacity(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelClose(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelClosedQ(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelLength(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelQ(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelReceive(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelSend(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelTryReceive(_ context.Context, mc *machine.MachineContext) error
- func PrimChannelTrySend(_ context.Context, mc *machine.MachineContext) error
- func PrimMakeAtomic(_ context.Context, mc *machine.MachineContext) error
- func PrimMakeChannel(_ context.Context, mc *machine.MachineContext) error
- func PrimMakeOnce(_ context.Context, mc *machine.MachineContext) error
- func PrimMakeRWMutex(_ context.Context, mc *machine.MachineContext) error
- func PrimMakeWaitGroup(_ context.Context, mc *machine.MachineContext) error
- func PrimOnceDo(_ context.Context, mc *machine.MachineContext) error
- func PrimOnceDoneQ(_ context.Context, mc *machine.MachineContext) error
- func PrimOnceQ(_ context.Context, mc *machine.MachineContext) error
- func PrimRWMutexQ(_ context.Context, mc *machine.MachineContext) error
- func PrimRWMutexReadLock(_ context.Context, mc *machine.MachineContext) error
- func PrimRWMutexReadUnlock(_ context.Context, mc *machine.MachineContext) error
- func PrimRWMutexTryReadLock(_ context.Context, mc *machine.MachineContext) error
- func PrimRWMutexTryWriteLock(_ context.Context, mc *machine.MachineContext) error
- func PrimRWMutexWriteLock(_ context.Context, mc *machine.MachineContext) error
- func PrimRWMutexWriteUnlock(_ context.Context, mc *machine.MachineContext) error
- func PrimWaitGroupAdd(_ context.Context, mc *machine.MachineContext) error
- func PrimWaitGroupDone(_ context.Context, mc *machine.MachineContext) error
- func PrimWaitGroupQ(_ context.Context, mc *machine.MachineContext) error
- func PrimWaitGroupWait(_ context.Context, mc *machine.MachineContext) error
Constants ¶
This section is empty.
Variables ¶
var AddToRegistry = Builder.AddToRegistry
AddToRegistry registers all Go interop primitives.
var Builder = registry.NewRegistryBuilder(addChannels, addWaitGroup, addRWMutex, addOnce, addAtomic)
Builder aggregates all Go interop registration functions.
var Extension = registry.NewExtension("gointerop", AddToRegistry)
Extension is the Go interop extension.
Functions ¶
func PrimAtomicCompareAndSwap ¶
func PrimAtomicCompareAndSwap(_ context.Context, mc *machine.MachineContext) error
PrimAtomicCompareAndSwap atomically compares and swaps (atomic-compare-and-swap! a old new) -> boolean
func PrimAtomicLoad ¶
func PrimAtomicLoad(_ context.Context, mc *machine.MachineContext) error
PrimAtomicLoad atomically loads the value (atomic-load a) -> value
func PrimAtomicQ ¶
func PrimAtomicQ(_ context.Context, mc *machine.MachineContext) error
PrimAtomicQ tests if an object is an AtomicBox (atomic? obj) -> boolean
func PrimAtomicStore ¶
func PrimAtomicStore(_ context.Context, mc *machine.MachineContext) error
PrimAtomicStore atomically stores a value (atomic-store! a value) -> void
func PrimAtomicSwap ¶
func PrimAtomicSwap(_ context.Context, mc *machine.MachineContext) error
PrimAtomicSwap atomically swaps and returns the old value (atomic-swap! a new) -> old
func PrimChannelCapacity ¶
func PrimChannelCapacity(_ context.Context, mc *machine.MachineContext) error
PrimChannelCapacity returns the channel's buffer capacity (channel-capacity ch) -> integer
func PrimChannelClose ¶
func PrimChannelClose(_ context.Context, mc *machine.MachineContext) error
PrimChannelClose closes the channel (channel-close! ch) -> void
func PrimChannelClosedQ ¶
func PrimChannelClosedQ(_ context.Context, mc *machine.MachineContext) error
PrimChannelClosedQ tests if a channel is closed (channel-closed? ch) -> boolean
func PrimChannelLength ¶
func PrimChannelLength(_ context.Context, mc *machine.MachineContext) error
PrimChannelLength returns the number of elements in the channel buffer (channel-length ch) -> integer
func PrimChannelQ ¶
func PrimChannelQ(_ context.Context, mc *machine.MachineContext) error
PrimChannelQ tests if an object is a channel (channel? obj) -> boolean
func PrimChannelReceive ¶
func PrimChannelReceive(_ context.Context, mc *machine.MachineContext) error
PrimChannelReceive receives a value from the channel (blocking) (channel-receive ch) -> value
func PrimChannelSend ¶
func PrimChannelSend(_ context.Context, mc *machine.MachineContext) error
PrimChannelSend sends a value on the channel (blocking) (channel-send! ch value) -> void
func PrimChannelTryReceive ¶
func PrimChannelTryReceive(_ context.Context, mc *machine.MachineContext) error
PrimChannelTryReceive attempts to receive without blocking (channel-try-receive ch) -> (values value received? open?)
func PrimChannelTrySend ¶
func PrimChannelTrySend(_ context.Context, mc *machine.MachineContext) error
PrimChannelTrySend attempts to send without blocking (channel-try-send! ch value) -> boolean
func PrimMakeAtomic ¶
func PrimMakeAtomic(_ context.Context, mc *machine.MachineContext) error
PrimMakeAtomic creates a new AtomicBox value (make-atomic initial) -> atomic
func PrimMakeChannel ¶
func PrimMakeChannel(_ context.Context, mc *machine.MachineContext) error
PrimMakeChannel creates a new channel (make-channel [buffer-size]) -> channel
func PrimMakeOnce ¶
func PrimMakeOnce(_ context.Context, mc *machine.MachineContext) error
PrimMakeOnce creates a new Once (make-once) -> once
func PrimMakeRWMutex ¶
func PrimMakeRWMutex(_ context.Context, mc *machine.MachineContext) error
PrimMakeRWMutex creates a new RWMutex (make-rw-mutex [name]) -> rw-mutex
func PrimMakeWaitGroup ¶
func PrimMakeWaitGroup(_ context.Context, mc *machine.MachineContext) error
PrimMakeWaitGroup creates a new WaitGroup (make-wait-group) -> wait-group
func PrimOnceDo ¶
func PrimOnceDo(_ context.Context, mc *machine.MachineContext) error
PrimOnceDo executes the thunk only once (once-do! once thunk) -> boolean (true if executed, false if already done)
func PrimOnceDoneQ ¶
func PrimOnceDoneQ(_ context.Context, mc *machine.MachineContext) error
PrimOnceDoneQ tests if the Once has been executed (once-done? once) -> boolean
func PrimOnceQ ¶
func PrimOnceQ(_ context.Context, mc *machine.MachineContext) error
PrimOnceQ tests if an object is a Once (once? obj) -> boolean
func PrimRWMutexQ ¶
func PrimRWMutexQ(_ context.Context, mc *machine.MachineContext) error
PrimRWMutexQ tests if an object is an RWMutex (rw-mutex? obj) -> boolean
func PrimRWMutexReadLock ¶
func PrimRWMutexReadLock(_ context.Context, mc *machine.MachineContext) error
PrimRWMutexReadLock acquires the read lock (rw-mutex-read-lock! rwm) -> void
func PrimRWMutexReadUnlock ¶
func PrimRWMutexReadUnlock(_ context.Context, mc *machine.MachineContext) error
PrimRWMutexReadUnlock releases the read lock (rw-mutex-read-unlock! rwm) -> void
func PrimRWMutexTryReadLock ¶
func PrimRWMutexTryReadLock(_ context.Context, mc *machine.MachineContext) error
PrimRWMutexTryReadLock tries to acquire the read lock (rw-mutex-try-read-lock! rwm) -> boolean
func PrimRWMutexTryWriteLock ¶
func PrimRWMutexTryWriteLock(_ context.Context, mc *machine.MachineContext) error
PrimRWMutexTryWriteLock tries to acquire the write lock (rw-mutex-try-write-lock! rwm) -> boolean
func PrimRWMutexWriteLock ¶
func PrimRWMutexWriteLock(_ context.Context, mc *machine.MachineContext) error
PrimRWMutexWriteLock acquires the write lock (rw-mutex-write-lock! rwm) -> void
func PrimRWMutexWriteUnlock ¶
func PrimRWMutexWriteUnlock(_ context.Context, mc *machine.MachineContext) error
PrimRWMutexWriteUnlock releases the write lock (rw-mutex-write-unlock! rwm) -> void
func PrimWaitGroupAdd ¶
func PrimWaitGroupAdd(_ context.Context, mc *machine.MachineContext) error
PrimWaitGroupAdd adds to the WaitGroup counter (wait-group-add! wg n) -> void
func PrimWaitGroupDone ¶
func PrimWaitGroupDone(_ context.Context, mc *machine.MachineContext) error
PrimWaitGroupDone decrements the WaitGroup counter (wait-group-done! wg) -> void
func PrimWaitGroupQ ¶
func PrimWaitGroupQ(_ context.Context, mc *machine.MachineContext) error
PrimWaitGroupQ tests if an object is a WaitGroup (wait-group? obj) -> boolean
func PrimWaitGroupWait ¶
func PrimWaitGroupWait(_ context.Context, mc *machine.MachineContext) error
PrimWaitGroupWait waits for the WaitGroup counter to reach zero (wait-group-wait! wg) -> void
Types ¶
This section is empty.