SiddiqSoft.DaemonLockfile 1.2.2

Install-Package SiddiqSoft.DaemonLockfile -Version 1.2.2
dotnet add package SiddiqSoft.DaemonLockfile --version 1.2.2
<PackageReference Include="SiddiqSoft.DaemonLockfile" Version="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SiddiqSoft.DaemonLockfile --version 1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SiddiqSoft.DaemonLockfile, 1.2.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SiddiqSoft.DaemonLockfile as a Cake Addin
#addin nuget:?package=SiddiqSoft.DaemonLockfile&version=1.2.2

// Install SiddiqSoft.DaemonLockfile as a Cake Tool
#tool nuget:?package=SiddiqSoft.DaemonLockfile&version=1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

DaemonLockfile : A simple lockfile implementation for modern C++

CodeQL Build Status

Objective

Provide for daemons (applications running as services under docker as an example) to limit themselves to a single instance per "name".

Requirements

  • C++20
  • Useful for running "daemons" under docker where you may not always have or wish for a true service under the operating system.

Usage

  • Use the nuget SiddiqSoft.DaemonLockfile
  • You can also git submodule: git submodule add https://github.com/SiddiqSoft/DaemonLockfile.git
  • Copy paste..whatever works.

Example (when using nuget to add the header in the solution)

#include "siddiqsoft/DaemonLockfile.hpp"


// Example daemon host structure
struct MyDaemonType
{
	siddiqsoft::DaemonLockfile myLockfile{"MyDaemonType", true}; //force acquire
	..
	..
};

// The "daemon" will hold the lock and when the application exits the lock will be released.
static MyDaemonType daemon;


int main(int argc, char *argv[])
{
	// Bailout immediately if we do not have a lock--this implies some other instance is running
	if(!daemon.myLockfile.isLocked) return 1;
	..
	..
	// We have the exclusice lock
}

Roadmap

<small align="right">

© 2021 Siddiq Software LLC. All rights reserved.

</small>

Product Versions
native native
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.2 188 7/22/2021
1.2.1-main0001 120 7/22/2021
1.2.0 194 7/15/2021
1.1.0 126 7/15/2021