Hive
Hive copied to clipboard
Prevent multiple instances of Hive to run at the same time
Part of code already written in main.cpp, but it's not complete! It's imperative to check for the runnnig pid, or a crash will lock Hive until reboot on macOS (shared memory not properly released by the OS when the last instance is killed)
Maybe take a look at https://github.com/itay-grudev/SingleApplication
Or use Fastbuild SystemMutex class: https://github.com/fastbuild/fastbuild/blob/main/Code/Core/Process/SystemMutex.cpp
It might even be more useful to ask the user if it wants to start Hive on another "port" if it's already running, but it means we have to keep a list of the running processes in a lock file, instead of just one.