www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/07/14:06:23

Sender: nate AT cartsys DOT com
Message-ID: <370B9C88.1E9C0005@cartsys.com>
Date: Wed, 07 Apr 1999 10:57:28 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
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: <Pine DOT SUN DOT 3 DOT 91 DOT 990406092755 DOT 6187I-100000 AT is> <ugX21aKg#GA DOT 184 AT rpc1284 DOT daytonoh DOT ncr DOT com>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019