Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5ec45bb

Browse files
committed
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.
1 parent 2d00190 commit 5ec45bb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/storage/ipc/shm_mq.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ shm_mq_receive(shm_mq_handle *mqh, Size *nbytesp, void **datap, bool nowait)
406406
if (shm_mq_get_sender(mq) == NULL)
407407
return SHM_MQ_WOULD_BLOCK;
408408
}
409-
else if (!shm_mq_wait_internal(mq, &mq->mq_sender, mqh->mqh_handle))
409+
else if (!shm_mq_wait_internal(mq, &mq->mq_sender, mqh->mqh_handle)
410+
&& shm_mq_get_sender(mq) == NULL)
410411
{
411412
mq->mq_detached = true;
412413
return SHM_MQ_DETACHED;

0 commit comments

Comments
 (0)