Contents

ponyboy47/locksmith

LockSmith is meant to be a system lock manager for swift executables.

Installation

Installation can be done through the Swift Package Manager

Add the following line to your dependencies in you Package.swift file

.package(url: "https://github.com/Ponyboy47/LockSmith.git", from: "0.5.0")

Usage

In your main.swift:

import LockSmith

guard var processLock = LockSmith.singleton else {
    print("Another instance of your executable is already running")
}

// Your executable code here...

// This forces the destructor to be called, which unlocks any leftover locks (like the process lock)
processLock = nil

// the end

More examples later...

License

MIT

Package Metadata

Repository: ponyboy47/locksmith

Default branch: master

README: README.md