Thread

  1. Re: [HACKERS] Thread-safe queueing?

    Bruce Momjian <maillist@candle.pha.pa.us> — 1999-11-14T03:11:36Z

    > Alternatively, you could forget about a queue per se, and just allow
    > each backend to execute the sending of its own log messages, using
    > a spinlock in shared memory to prevent concurrent issuance of log
    > messages on channels where that's a problem.  That might be the
    > simplest and most robust approach.
    
    Hold on.  Unix guarantees all write() calls are atomic, so no one gets
    in between that write.  Why not just collect the output into one buffer
    in the backend, and blast the entire buffer in one write() to the log
    file.
    
    I don't think there is any way another backend could mess that up.
    
    -- 
      Bruce Momjian                        |  http://www.op.net/~candle
      maillist@candle.pha.pa.us            |  (610) 853-3000
      +  If your life is a hard drive,     |  830 Blythe Avenue
      +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026