Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: nissankl@cig.mot.com (Ramakrishna Nissankula)
Subject: A question on File locking
Date: 1998/02/11	[thread overview]
Message-ID: <6bta6g$ndh$1@trotsky.cig.mot.com> (raw)


I have a question on file locking. Can anyone pl answer this by e-mail?

In UNIX, I can lock a file only after opening it for reading or writing.

What happens in the following scenario?
   Process1                                  Process2
    
    d = open(file for writing)            d = open(file for writing)
    mandatory lock the file               mandatory lock the file
     write sth                              write some other thing
    unlock                                unlock
    close                                 close
    
The problem is that the process that locks first will lose its data 
because the other process has opened the file for writing.

How can I get around this problem? 

BR
Ramki




                 reply	other threads:[~1998-02-11  5:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox