LockSmith

0.3.0

Swift Process, File, and Thread locking utilities
Ponyboy47/LockSmith

What's New

0.3.0

2018-06-08T23:19:20Z

LockSmith

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

By creating a LockSmith instance, you are locking down your current swift executable so that no other instance can be running. You also gain access to easy locking mechanisms for files and threads to help make you program thread-safe.

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.2.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

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

Last updated: Sat Mar 16 2024 01:17:15 GMT-0900 (Hawaii-Aleutian Daylight Time)