|
You don't say what UNIX you are on but consider file locks instead of semaphores.
start with 'man flock' if you're on Linux.
Otherwise, man fcntl, then look for FD_SETLK or FD_GETLK to start off.
Depending on your OS you can get file locks at different levels; struct flock can provide locking a part of a file.
Semaphores are mostly used for access to shared memory.
|