[fpc-pascal] Cross-platform single instance

Vincent Snijders vsnijders at quicknet.nl
Tue Oct 2 22:01:14 CEST 2007


Felipe Monteiro de Carvalho schreef:
> Hello,
> 
> I was looking into a way to detect if an instance of my application is
> running. Is there a cross-platform solution on rtl or fcl?
> 
> It seams that semaphores would be a good solution. I took a look at
> pthreads and PSemaphore but that is only an alias for unix specific
> semaphores.
> 
> If there is no current solution for this problem, may I implement
> pthreads for Windows? Or maybe a new unit? I remember using Mutex
> Windows APIs to do what I need in the past. There are probably
> Semaphore functions that could be used to provide a uniform interface
> across the supported platforms.
> 

Have you considered UniqueInstance?
http://wiki.lazarus.freepascal.org/UniqueInstance

Vincent



More information about the fpc-pascal mailing list