poll_timeout.patch
application/octet-stream
Filename: poll_timeout.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/port/unix_latch.c | 0 | 0 |
diff --git a/src/backend/port/unix_latch.c b/src/backend/port/unix_latch.c
new file mode 100644
index bbd1810..9f934f3
*** a/src/backend/port/unix_latch.c
--- b/src/backend/port/unix_latch.c
***************
*** 46,51 ****
--- 46,54 ----
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
+ #ifdef HAVE_POLL
+ #include "portability/instr_time.h"
+ #endif
#include "miscadmin.h"
#include "postmaster/postmaster.h"
*************** WaitLatchOrSocket(volatile Latch *latch,
*** 255,260 ****
--- 258,267 ----
waiting = true;
do
{
+ #ifdef HAVE_POLL
+ instr_time poll_start;
+ instr_time poll_time;
+ #endif
/*
* Clear the pipe, then check if the latch is set already. If someone
* sets the latch between this and the poll()/select() below, the
*************** WaitLatchOrSocket(volatile Latch *latch,
*** 311,323 ****
}
/* Sleep */
rc = poll(pfds, nfds, (int) timeout);
/* Check return code */
if (rc < 0)
{
! if (errno == EINTR)
continue;
waiting = false;
ereport(ERROR,
(errcode_for_socket_access(),
--- 318,340 ----
}
/* Sleep */
+ INSTR_TIME_SET_CURRENT(poll_start);
rc = poll(pfds, nfds, (int) timeout);
/* Check return code */
if (rc < 0)
{
! if (errno == EINTR)
! {
! if (timeout>0)
! {
! INSTR_TIME_SET_CURRENT(poll_time);
! INSTR_TIME_SUBTRACT(poll_time, poll_start);
! timeout-=INSTR_TIME_GET_MILLISEC(poll_time);
! if (timeout < 0) timeout=0;
! };
continue;
+ };
waiting = false;
ereport(ERROR,
(errcode_for_socket_access(),