Commit 4efe26c
committed
shm_mq: Third attempt at fixing nowait behavior in shm_mq_receive.
Commit a1480ec purported to fix the
problems with commit b2ccb5f, but it
didn't completely fix them. The problem is that the checks were
performed in the wrong order, leading to a race condition. If the
sender attached, sent a message, and detached after the receiver
called shm_mq_get_sender and before the receiver called
shm_mq_counterparty_gone, we'd incorrectly return SHM_MQ_DETACHED
before all messages were read. Repair by reversing the order of
operations, and add a long comment explaining why this new logic is
(hopefully) correct.1 parent 0279f62 commit 4efe26c
1 file changed
+17
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
504 | 518 | | |
505 | 519 | | |
506 | | - | |
| 520 | + | |
507 | 521 | | |
508 | | - | |
| 522 | + | |
| 523 | + | |
509 | 524 | | |
510 | 525 | | |
511 | 526 | | |
| |||
0 commit comments