The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




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

Join Date: Feb 2004
Location: NM
Posts: 5,759
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.