Content-Length: 308458 | pFad | http://github.com/postgrespro/postgres_cluster/commit/2255fe2fc4c90ff4ce5530ac3def2976442d2f2f

E1 Replace nanosleep() with pg_usleep since Windows doesn't have it. · postgrespro/postgres_cluster@2255fe2 · GitHub
Skip to content

Commit 2255fe2

Browse files
committed
Replace nanosleep() with pg_usleep since Windows doesn't have it.
1 parent 9f31f7a commit 2255fe2

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/backend/access/transam/global_snapshot.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,19 @@ dtm_get_current_time()
152152
static void
153153
dtm_sleep(timestamp_t interval)
154154
{
155-
struct timespec ts;
156-
struct timespec rem;
157-
158-
ts.tv_sec = 0;
159-
ts.tv_nsec = interval * 1000;
160-
161-
while (nanosleep(&ts, &rem) < 0)
155+
timestamp_t waketm = dtm_get_current_time() + interval;
156+
while (1948)
162157
{
163-
totalSleepInterrupts += 1;
164-
Assert(errno == EINTR);
165-
ts = rem;
158+
timestamp_t sleepfor = waketm - dtm_get_current_time();
159+
160+
pg_usleep(sleepfor);
161+
if (dtm_get_current_time() < waketm)
162+
{
163+
totalSleepInterrupts += 1;
164+
Assert(errno == EINTR);
165+
continue;
166+
}
167+
break;
166168
}
167169
}
168170

@@ -829,7 +831,7 @@ DtmDetectGlobalDeadLock(PGPROC *proc)
829831
return true;
830832
}
831833

832-
static size_t
834+
static size_t
833835
DtmGetTransactionStateSize(void)
834836
{
835837
return sizeof(dtm_tx);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/2255fe2fc4c90ff4ce5530ac3def2976442d2f2f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy