WLBF / single-instance

A rust library for single instance application.
MIT License
35 stars 8 forks source link

Refactored into common flock-based implementation for POSIX platforms #13

Closed ancwrd1 closed 3 years ago

ancwrd1 commented 3 years ago

This PR implements a common flock-based solution for POSIX platforms as advised in different articles. We use this code in our product so I thought to make a PR into upstream.

The issue with Unix domain sockets is that there could be a stale socket file left on the filesystem which will cause the bind operation to fail. This situation is difficult to resolve correctly.

ancwrd1 commented 3 years ago

Just realized that for Linux the namespace-based UDS was used, so this PR might not be relevant. You can decide.

WLBF commented 3 years ago

Yeah, I implemented flock-based solution for both linux and unix in the past. For now, according #6 , I think namespace-based UDS is a proper choice.