Skip to content
Snippets Groups Projects
Commit 5ec45bb7 authored by Robert Haas's avatar Robert Haas
Browse files

Consistently allow reading of messages from a detached shm_mq.

This was intended to work always, but the previous code only allowed
it if at least one message was successfully read by the receiver
before the sender detached the queue.

Report by Petr Jelinek.  Patch by me.
parent 2d001904
No related branches found
No related tags found
No related merge requests found
...@@ -406,7 +406,8 @@ shm_mq_receive(shm_mq_handle *mqh, Size *nbytesp, void **datap, bool nowait) ...@@ -406,7 +406,8 @@ shm_mq_receive(shm_mq_handle *mqh, Size *nbytesp, void **datap, bool nowait)
if (shm_mq_get_sender(mq) == NULL) if (shm_mq_get_sender(mq) == NULL)
return SHM_MQ_WOULD_BLOCK; return SHM_MQ_WOULD_BLOCK;
} }
else if (!shm_mq_wait_internal(mq, &mq->mq_sender, mqh->mqh_handle)) else if (!shm_mq_wait_internal(mq, &mq->mq_sender, mqh->mqh_handle)
&& shm_mq_get_sender(mq) == NULL)
{ {
mq->mq_detached = true; mq->mq_detached = true;
return SHM_MQ_DETACHED; return SHM_MQ_DETACHED;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment