Documentation
¶
Overview ¶
Package ipcm (Inter Process Communication Mutex) provides tooling for orchestrating inter-process communication (IPC) on different operating systems.
Index ¶
- type ConfigureError
- type LockError
- func (o *LockError) Error() string
- func (o *LockError) FailedToCreateParentDirectory() bool
- func (o *LockError) FailedToCreated() bool
- func (o *LockError) SyncMutexLockTimedOut() bool
- func (o *LockError) SystemCallFailed() bool
- func (o *LockError) SystemMutexLockTimedOut() bool
- func (o *LockError) WindowsDllLoadFailed() bool
- func (o *LockError) WindowsProcedureLoadFailed() bool
- type Mutex
- type MutexConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigureError ¶
type ConfigureError struct {
// contains filtered or unexported fields
}
func (*ConfigureError) Error ¶
func (o *ConfigureError) Error() string
func (*ConfigureError) PathNotFullyQualified ¶
func (o *ConfigureError) PathNotFullyQualified() bool
func (*ConfigureError) ResourceNotSpecified ¶
func (o *ConfigureError) ResourceNotSpecified() bool
type LockError ¶
type LockError struct {
// contains filtered or unexported fields
}
func (*LockError) FailedToCreateParentDirectory ¶
func (*LockError) FailedToCreated ¶
func (*LockError) SyncMutexLockTimedOut ¶
func (*LockError) SystemCallFailed ¶
func (*LockError) SystemMutexLockTimedOut ¶
func (*LockError) WindowsDllLoadFailed ¶
func (*LockError) WindowsProcedureLoadFailed ¶
type Mutex ¶
type Mutex interface {
// Lock locks the mutex.
//
// Be advised that this call will block until the mutex can be locked.
// If an error occurs while trying to lock the Mutex, the method will
// keep trying. Any underlying errors that occur when locking the OS
// mutex are hidden from the caller when using this method.
Lock()
// TimedTryLock attempts to lock the Mutex within the specified
// timeout. A non-nil error is returned when the Mutex cannot be
// locked in time.
TimedTryLock(time.Duration) error
// Unlock unlocks the Mutex. Like sync.Mutex, this call will panic
// if the Mutex is already unlocked.
Unlock()
}
Mutex is a thread-safe object that functions in a similar manner to sync.Mutex, only it works across process boundaries. It can be used to orchestrate the execution of threads between different processes in the same way that a sync.Mutex controls access to data between multiple go routines.
In other words, when one routine locks the mutex, all other routines within the current process and external process(es) will block if they attempt to lock the mutex.
type MutexConfig ¶
type MutexConfig struct {
// Resource is an object that exists outside of the running process.
// Other processes must use the same value to reference the Mutex.
//
// On unix systems, this must be a string representing a fully
// qualified file path.
// For example:
// /var/myapplication/lock
//
// On Windows, this is a string representing the name of a Mutex
// object. The string can consist of any character except backslash.
// For more information, refer to the 'CreateMutexW' API documentation:
// https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-createmutexw
// For example:
// myapplication
Resource string
}
MutexConfig configures a Mutex.