Page 3 of 3

Re: Enforce just one instance?

Posted: Wed Mar 31, 2021 5:37 pm
by grump
ivan wrote: Wed Mar 31, 2021 5:08 pm should be available in love.filesystem by default
Agreed.

I got this lib that could provide file locking (on physical filesystems), but I'm hesitant to add those big platform-specific calls that go beyond basic POSIX and the occasional Windows support because of the amount of code, testing, and possible maintenance that is required. Maybe I'll reconsider my stance on this.

Re: Enforce just one instance?

Posted: Thu Apr 01, 2021 1:23 am
by RNavega
pgimeno wrote: Wed Mar 31, 2021 11:12 am It's not even listening. I doubt it consumes CPU.
Looking into the source to luasocket, it does seem to be simpler than I was thinking:
- https://github.com/diegonehab/luasocket ... ket.c#L154 (bind from WinSocket2 on Windows)
- https://github.com/diegonehab/luasocket ... ket.c#L135 (bind from sys/socket.h on *NIX)

The bind call is just giving the socket a name, it isn't yet listening or connecting to something else. So that would make it work like a cross-platform global mutex.