This is the mail archive of the
cygwin
mailing list for the Cygwin project.
file locking problem
- From: "BJ" <baj2107 at columbia dot edu>
- To: cygwin at cygwin dot com
- Date: Wed, 19 Sep 2007 19:30:26 -0400
- Subject: file locking problem
I have a file locking problem that is solved under Mac and Linux using
fcntl:
int lockRepFile (int fd, char lock, size_t from, size_t length) {
struct flock fl;
fl.l_start = from;
fl.l_len = length;
fl.l_pid = 0;
if (lock == 'r') fl.l_type = F_RDLCK;
else if (lock == 'w') fl.l_type = F_WRLCK;
else if (lock == 'u') fl.l_type = F_UNLCK;
fl.l_whence = SEEK_SET;
return (fcntl(fd, F_SETLKW, &fl));
}
Now, unfortunately this hangs occasionally using cygwin - gcc.
I would appreciate any comments and suggestions on how debug this and how to
improve the performance i.e. stop it from hanging...
Thanks
B
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/