Sender: nate AT cartsys DOT com Message-ID: <370B9C88.1E9C0005@cartsys.com> Date: Wed, 07 Apr 1999 10:57:28 -0700 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.5 i586) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: file locking References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Tanes Sriviroolchai wrote: > > Eli Zaretskii wrote in message ... > > > > > >> second of all, if you lock a file and another instance tries to write to > >> it, what happens? how can you see if a file or region is locked? > > > >On DOS/Windows or on Unix? > > > >On Unix, the other process which tries to write blocks until the file > >is unlocked. On DOS/Windows I think the write call fails, but you'll > >need to try to make sure. > > It should be "On Unix, the other process which tried to write without test > lock before will be successful. However, if that process test lock > (with blocked) before write it will be blocked until that file is unlocked. > Or it will be failed if that process test lock without block." Confusion between cooperative (`flock') and mandatory (`fcntl', sometimes) locking. Cooperative locking means that the process *should* acquire the lock before writing, but isn't stopped if it doesn't. Mandatory means that attempts to access a locked area are blocked; not all systems implement this. -- Nate Eldredge nate AT cartsys DOT com