locking

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireLock

func AcquireLock(ctx context.Context, launcherFlags *flags.LauncherFlags)

Blocks until the lock is available, claims it and restarts.

func AddApplicationSignature

func AddApplicationSignature(sig *system.ProcessSignature)

Adds the supplied ProcessSignature to the execution lock file.

func AwaitApplicationsTerminated

func AwaitApplicationsTerminated(ctx context.Context)

Waits for the processes from all previous executions to stop running and then removes the execution lock file.

func MinimizeApplicationSignaturesList

func MinimizeApplicationSignaturesList() bool

MinimizeApplicationSignaturesList removes any process signatures no longer running from the execution lock file if it exists. If no process signature is running, the execution lock file is removed and the function returns true.

func ReleaseLock

func ReleaseLock()

Releases the lock.

func Restart

func Restart(forwardLauncherLockOwnership bool, launcherFlags *flags.LauncherFlags)

func RestartWithBinary

func RestartWithBinary(forwardLauncherLockOwnership bool, binaryPath string, launcherFlags *flags.LauncherFlags)

Starts a new instance of the calling executable, writes the new process signature into the launcher signature file and quits the current instance.

func WaitForProcessSignatureToStopRunning

func WaitForProcessSignatureToStopRunning(ctx context.Context, procSig *system.ProcessSignature)

Types

type LockActionResult

type LockActionResult int
const (
	LockUnavailable LockActionResult = iota // Lock is claimed by another running process.
	LockClaimed                             // The current process claimed the lock, and now owns it.
	LockOwned                               // The current process owns the lock already.
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL