home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 17085 < prev    next >
Encoding:
Text File  |  1992-11-24  |  834 b   |  26 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!spool.mu.edu!darwin.sura.net!jvnc.net!nuscc!nusunix3.nus.sg!isc40038
  3. From: isc40038@nusunix1.nus.sg (LIM FANG HOW)
  4. Subject: How to implement mandatory locking
  5. Message-ID: <1992Nov24.023026.3601@nuscc.nus.sg>
  6. Sender: usenet@nuscc.nus.sg
  7. Organization: National University of Singapore
  8. X-Newsreader: TIN [version 1.1 PL6]
  9. Date: Tue, 24 Nov 1992 02:30:26 GMT
  10. Lines: 14
  11.  
  12. I am working on a interprocess communication project. It consists of a
  13. set of concurrent processes accessing a set of files. To achieve
  14. consistency, I had tried to use advisory locking with the following
  15. command :
  16.         for (x=1;x<=2000;++x) {
  17.            if ((flock(fd,LOCK_EX|LOCK_NB))==-1)
  18.               print error messages;
  19.             else break;
  20.         }
  21.  
  22. However, it gives me a deadlock situation.
  23.  
  24. Thank you all.
  25.  
  26.