From 496ea7a87633a64ddab65b375e0be56fa60873cc Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sat, 24 Feb 2001 22:42:45 +0000
Subject: [PATCH] At least on HPUX, select with delay.tv_sec = 0 and
 delay.tv_usec = 1000000 does not lead to a one-second delay, but to an
 immediate EINVAL failure. This causes CHECKPOINT to crash with s_lock_stuck
 much too quickly :-(. Fix by breaking down the requested wait div/mod 1e6.

---
 src/backend/storage/buffer/s_lock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/storage/buffer/s_lock.c b/src/backend/storage/buffer/s_lock.c
index ef70f45d887..6bb76c2cda8 100644
--- a/src/backend/storage/buffer/s_lock.c
+++ b/src/backend/storage/buffer/s_lock.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.33 2001/02/18 04:39:42 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.34 2001/02/24 22:42:45 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -91,8 +91,8 @@ s_lock_sleep(unsigned spins, int timeout, int microsec,
 
 	if (microsec > 0)
 	{
-		delay.tv_sec = 0;
-		delay.tv_usec = microsec;
+		delay.tv_sec = microsec / 1000000;
+		delay.tv_usec = microsec % 1000000;
 	}
 	else
 	{
-- 
GitLab