Skip to content

Commit 5ed13a6

Browse files
committed
Fixed missing runtime release in PQisBusy stub
1 parent 18d43a4 commit 5ed13a6

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/postgresql_stubs.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,10 +1101,21 @@ CAMLprim value PQgetResult_stub(value v_conn)
11011101
}
11021102

11031103
noalloc_conn_info_intnat(PQconsumeInput)
1104-
noalloc_conn_info(PQisBusy, Val_bool)
1104+
11051105
noalloc_conn_info_intnat(PQflush)
11061106
noalloc_conn_info_intnat(PQsocket)
11071107

1108+
CAMLprim value PQisBusy_stub(value v_conn)
1109+
{
1110+
CAMLparam1(v_conn);
1111+
PGconn *conn = get_conn(v_conn);
1112+
bool res;
1113+
caml_enter_blocking_section();
1114+
res = PQisBusy(conn);
1115+
caml_leave_blocking_section();
1116+
CAMLreturn(Val_bool(res));
1117+
}
1118+
11081119
CAMLprim value PQCancel_stub(value v_conn)
11091120
{
11101121
CAMLparam1(v_conn);
@@ -1392,9 +1403,9 @@ CAMLprim value PQendcopy_stub_bc(value v_conn)
13921403
static inline void notice_ml(void *cb, const char *msg)
13931404
{
13941405
value v_msg;
1395-
/* CR mmottl for mmottl: this is not reliable and can lead to segfaults,
1396-
because the runtime lock may already be held (but not usually).
1397-
A runtime feature is needed to fully support this. */
1406+
/* CR mmottl for mmottl: this is not reliable and can lead to deadlocks or
1407+
other unintended behavior, because the runtime lock may already be held
1408+
(but not usually). A runtime feature is needed to fully support this. */
13981409
caml_leave_blocking_section();
13991410
v_msg = make_string(msg);
14001411
caml_callback(((np_callback *) cb)->v_cb, v_msg);

0 commit comments

Comments
 (0)