Running only one instance of the app

Steven Schveighoffer schveiguy at gmail.com
Thu Dec 2 13:28:12 UTC 2021


On 12/2/21 7:05 AM, Bagomot wrote:

> This works for Windows. I need something similar for Linux and Macos.
> 
> Tell me how, if you know. Maybe the standard library D already has the 
> required functionality? Or are there better ways to only run one 
> instance of the app?

Typically this is done using pid files.

https://linux.die.net/man/3/pidfile

But I don't know if MacOS has a specialized call for it, or if you have 
to do it yourself. I think you need to lock the file with `flock` to get 
it to work properly.

-Steve


More information about the Digitalmars-d-learn mailing list