The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 08-28-2007
jim mcnamara jim mcnamara is offline
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,365
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.
Reply With Quote