c - Proper way to implement environment locks -


in case have program needs basic configuration files cannot modified when running (during start-up), proper way implement lock in directory environment?

details:

the scenario i'm thinking is: software able modify files. so, need protect environment other instances of software. software might composed of several different programs. so, need find interface straightforward share among processes.

idea 1:

one way acquiring lock (flock) each configuration file. impractical implement , maintain.

idea 2:

the second way i've been thinking create .lock file in directory during start-up , delete when config files safe modified. i've seen many commercial softwares using similar approaches. however, suspect lack of atomicity of these operations might issue. method safe when several applications might concurrently try create/poll/delete lock file?


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -