Re: [HACKERS] Thread-safe queueing? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Thread-safe queueing?
Date
Msg-id 199911140311.WAA10351@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Thread-safe queueing?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Thread-safe queueing?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> 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,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Thread-safe queueing?
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Thread-safe queueing?