• Robert Haas's avatar
    Extend shm_mq API with new functions shm_mq_sendv, shm_mq_set_handle. · 7bb0e974
    Robert Haas authored
    shm_mq_sendv sends a message to the queue assembled from multiple
    locations.  This is expected to be used by forthcoming patches to
    allow frontend/backend protocol messages to be sent via shm_mq, but
    might be useful for other purposes as well.
    
    shm_mq_set_handle associates a BackgroundWorkerHandle with an
    already-existing shm_mq_handle.  This solves a timing problem when
    creating a shm_mq to communicate with a newly-launched background
    worker: if you attach to the queue first, and the background worker
    fails to start, you might block forever trying to do I/O on the queue;
    but if you start the background worker first, but then die before
    attaching to the queue, the background worrker might block forever
    trying to do I/O on the queue.  This lets you attach before starting
    the worker (so that the worker is protected) and then associate the
    BackgroundWorkerHandle later (so that you are also protected).
    
    Patch by me, reviewed by Stephen Frost.
    7bb0e974
shm_mq.c 32.5 KB