Re: [HACKERS] Thread-safe queueing?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tim Holloway <mtsinc(at)southeast(dot)net>, pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Thread-safe queueing?
Date: 1999-11-14 03:11:36
Message-ID: 199911140311.WAA10351@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-11-14 03:48:13 Re: [HACKERS] Thread-safe queueing?
Previous Message Tom Lane 1999-11-14 02:28:54 Re: [HACKERS] Thread-safe queueing?