Xabe.FileLock
No description available
Install / Use
/learn @tomaszzmuda/Xabe.FileLockREADME
Xabe.FileLock
.NET Standard library providing exclusive lock on file.
Using
Install the Xabe.FileLock NuGet package via nuget:
PM> Install-Package Xabe.FileLock
Creating file lock:
ILock fileLock = new FileLock(file);
fileLock.TryAcquire(TimeSpan.FromSeconds(15), true);
This will create lock file with extension ".lock" in the same directory. Example: "/tmp/data.txt" -> "/tmp/data.lock".
Last parameter is optional and defines if lock should be automatically refreshing before expired.
If file already has lock file, and it time haven't expired, method returns false.
Recommended using
ILock fileLock = new FileLock(file);
if(await fileLock.TryAcquire(TimeSpan.FromSeconds(15), true))
{
using(fileLock)
{
// file operations here
}
}
Lincence
Xabe.FileLock is licensed under MIT - see License for details.
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
