Home > OS >  How to prevent secondary program start?
How to prevent secondary program start?

Time:10-20

In Windows, you can set the Shared semaphore, using Qt can set the amount of Shared;
But I want to directly use the gnu C + + (standard C, C + + library), and how to prevent second run?

There are many online introduction write a tag file, check the file whether there is a starting (abort, kill?) , with the process name, process name, path instead?) Don't feel too good,

CodePudding user response:

I am the do
Program start for the first time to obtain the pid
The pid written to the file
Program for the second time when start to determine the first time you start the pid is running state
  • Related