windows - Where should I create a PID/lock file when writing a portable application -
i modifying application have written prevent multiple instances running @ same time.
my first thought, (according the linux fhs) store pid file in /var/run
. in way, can check if pid file exists, , exit error if does.
now, if want app portable, have consider /var/run
not exist on every system (f.ex. windows).
what best practice in case?
note: not have pid file. 0-byte "lock" file trick well. pid file have advantage of providing pid whomever need investigate problems.
clarification: application backup script run defined user.
one of way make application rely on porting framework (like qt). such framework provides abstraction of platform, allowing put @ "correct place" (e.g. windows, changes between xp, vista/7). might example have @ qsettings if can't rely on framework, digging code might provide advanced answer.
Comments
Post a Comment