Enforce just one instance?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Enforce just one instance?

Post 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.
RNavega
Party member
Posts: 239
Joined: Sun Aug 16, 2020 1:28 pm

Re: Enforce just one instance?

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 61 guests