This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Bug report: flock
- To: gnu-win32 at cygnus dot com
- Subject: Bug report: flock
- From: Pasqualino Assini <assini at kamus dot it>
- Date: Sat, 22 Feb 1997 23:22:04 +0100
- Organization: Kamus - Internet Consulting
- Reply-To: assini at kamus dot it
It appears that there is some problem with flock in beta 17.1 under
Windows 3.51 and Windows 95
I use flock to get an exclusive lock by using the routine listed at the
end of the message.
While it seems to work perfectly under my WinNT 4.0 workstation a client
told me that the lock is not granted under WinNT 3.51 server and Win95.
It also doesn't work on any platform with beta 16.1 (but that's quite
normal as I think that flock support wasn't there at the time!)
Did anyone else experiment with flock support ?
int lock_open(const char* filename
,int timeout
,int flags
)
{
int fid;
TRACE2("Trying to get lock on file %s",filename);
fid=open(filename, flags, S_IREAD|S_IWRITE);
if (fid == -1) return(-1);
struct flock cntrl;
cntrl.l_type=F_WRLCK; // exclusive lock
int error;
int elapsed=0;
while ( (error=fcntl(fid,F_SETLK,&cntrl)) && (elapsed<timeout) )
{
sleep(1);
++elapsed;
}
if (error) return -1;
return fid;
}
--
Pasqualino Assini --- Kamus Internet Consulting
Via Nazioni Unite,47 --- 50126 Firenze Italy
Tel/Fax: +39 55 68.58.07 --- Tel/Fax: +39 55 48.29.29
Tel: +39 584 79.11.31 ---
Email: assini@kamus.it --- Web: http://www.kamus.it/
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".