oblique / named-lock Goto Github PK
View Code? Open in Web Editor NEWCross-platform implementation of cross-process named locks
License: MIT License
Cross-platform implementation of cross-process named locks
License: MIT License
Hello! My program fails with CreateFailed
if compiled using musl instead of glibc on Linux.
Is there something I can do to aid debugging here? Thanks
/tmp gets cleaned on macOS periodically which breaks long running applications holding locks. I assume other unix platforms might have similar problem.
For example, if a lock is named /one/two
the file will be created at /one/two.lock
.
I actually think this is quite a useful behaviour, but I think it may need to be documented.
This would be a major breaking change and I'm not completely sure if I like it myself, but I would like to at least discuss it.
Imagine a hypothetical downstream project that creates locks using names that are only known at runtime. Let's say these names are strings with arbitrary characters. Then some calls to NamedLock::create
will inevitably return Err(Error::InvalidCharacter)
.
This could be avoided if the strings were first encoded so that reserved characters ('\0'
, '/'
, and '\\'
) were transformed to non-reserved characters. The exact encoding scheme is a bikeshed I'm not ready to dive into at the moment, but something like percent-encoding or Base32 would fit the bill.
Pros:
Cons:
Questions:
NamedLock::create
, or to make a new constructor method entirely?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.