* shareinput_reader_notifydone * * Called by the reader (consumer) to notify the writer (producer) that * it is done reading tuples from disk. * * This is a non-blocking operation. */
| 1003 | * This is a non-blocking operation. |
| 1004 | */ |
| 1005 | static void |
| 1006 | shareinput_reader_notifydone(shareinput_Xslice_reference *ref, int nconsumers) |
| 1007 | { |
| 1008 | shareinput_Xslice_state *state = ref->xslice_state; |
| 1009 | int ndone = pg_atomic_add_fetch_u32(&state->ndone, 1); |
| 1010 | |
| 1011 | /* If we were the last consumer, wake up the producer. */ |
| 1012 | if (ndone >= nconsumers) |
| 1013 | ConditionVariableBroadcast(&state->ready_done_cv); |
| 1014 | |
| 1015 | elog((Debug_shareinput_xslice ? LOG : DEBUG1), "SISC READER (shareid=%d, slice=%d): wrote notify_done", |
| 1016 | ref->share_id, currentSliceId); |
| 1017 | } |
| 1018 | |
| 1019 | /* |
| 1020 | * shareinput_writer_waitdone |
no test coverage detected