This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]