mturk       2005/04/16 07:33:27

  Modified:    jk/native/common jk_mt.h
  Log:
  Check if the command was interrupted by a signal before the lock was
  checked or acquired.
  
  Revision  Changes    Path
  1.19      +11 -5     jakarta-tomcat-connectors/jk/native/common/jk_mt.h
  
  Index: jk_mt.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_mt.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- jk_mt.h   11 Apr 2005 06:36:02 -0000      1.18
  +++ jk_mt.h   16 Apr 2005 14:33:27 -0000      1.19
  @@ -100,12 +100,14 @@
   
   #define JK_ENTER_LOCK(x, rc)        \
       do {                            \
  -      rc = flock((x), LOCK_EX) == -1 ? JK_FALSE : JK_TRUE; \
  +      while ((rc = flock((x), LOCK_EX) < 0) && (errno == EINTR)); \
  +      rc = rc == 0 ? JK_TRUE : JK_FALSE; \
       } while (0)
   
   #define JK_LEAVE_LOCK(x, rc)        \
       do {                            \
  -      rc = flock((x), LOCK_UN) == -1 ? JK_FALSE : JK_TRUE; \
  +      while ((rc = flock((x), LOCK_UN) < 0) && (errno == EINTR)); \
  +      rc = rc == 0 ? JK_TRUE : JK_FALSE; \
       } while (0)
   
   #else
  @@ -117,7 +119,9 @@
         _fl.l_whence = SEEK_SET;      \
         _fl.l_start  = 0;             \
         _fl.l_len    = 1L;            \
  -      rc = fcntl((x), F_SETLKW, &_fl) == -1 ? JK_FALSE : JK_TRUE; \
  +      _fl.l_pid    = 0;             \
  +      while ((rc = fcntl((x), F_SETLKW, &_fl) < 0) && (errno == EINTR)); \
  +      rc = rc == 0 ? JK_TRUE : JK_FALSE; \
       } while (0)
   
   #define JK_LEAVE_LOCK(x, rc)        \
  @@ -127,7 +131,9 @@
         _fl.l_whence = SEEK_SET;      \
         _fl.l_start  = 0;             \
         _fl.l_len    = 1L;            \
  -      rc = fcntl((x), F_SETLK, &_fl) == -1 ? JK_FALSE : JK_TRUE; \
  +      _fl.l_pid    = 0;             \
  +      while ((rc = fcntl((x), F_SETLKW, &_fl) < 0) && (errno == EINTR)); \
  +      rc = rc == 0 ? JK_TRUE : JK_FALSE; \
       } while (0)
   #endif /* HAVE_FLOCK */
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to