Restricting D applications to a single instance

Preetpal preetpal.sohal at gmail.com
Mon Feb 22 02:29:54 UTC 2021


I want to restrict a D application to a single instance. Is there 
a way to do this using the D standard library?

I know this can be done using named mutexes on Windows using 
Windows-specific APIs but I want to avoid this in general because 
I want to port the code to FreeBSD without introducing another 
code path for this functionality. I also know that server 
applications lock PID files to achieve this but I would like to 
avoid creating temporary files.

I want to implement this functionality in the following code: 
https://gist.github.com/preetpalS/d2482d6ec91eb8147e6cff43ab197ed5




More information about the Digitalmars-d-learn mailing list