Re: BUG #1044: snprintf() shipped with PostgreSQL is not thread
От | Bruce Momjian |
---|---|
Тема | Re: BUG #1044: snprintf() shipped with PostgreSQL is not thread |
Дата | |
Msg-id | 200401081715.i08HFQQ28979@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: BUG #1044: snprintf() shipped with PostgreSQL is not thread safe (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: BUG #1044: snprintf() shipped with PostgreSQL is not thread safe
|
Список | pgsql-bugs |
Tom Lane wrote: > "PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes: > > Some OSes lack proper snprintf()/vsnprintf() fuctions so PostgreSQL includes > > its own version (src/port/snprintf.c) during building. Unfortunately, this > > version of snprintf() is not reentrant (it uses global vars to keep internal > > state), so for example running libpq-based concurrent applications (threads) > > causes libpq fuctions to fail sometimes. > > What platforms have workable thread support but not snprintf? I think > this change is not likely to accomplish much except clutter the snprintf > code ... What we could do is to throw a compile #error if you hit our own snprintf() and are compiling with threads enabled. Patch attached and applied. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: src/port/snprintf.c =================================================================== RCS file: /cvsroot/pgsql-server/src/port/snprintf.c,v retrieving revision 1.2 diff -c -c -r1.2 snprintf.c *** src/port/snprintf.c 29 Nov 2003 22:41:31 -0000 1.2 --- src/port/snprintf.c 8 Jan 2004 17:12:47 -0000 *************** *** 35,40 **** --- 35,45 ---- /* might be in either frontend or backend */ #include "postgres_fe.h" + #ifdef ENABLE_THREAD_SAFETY + #error The replacement snprintf() is not thread-safe. \ + Your platform must have a thread-safe snprintf() to compile with threads. + #endif + #include <sys/ioctl.h> #include <sys/param.h>
В списке pgsql-bugs по дате отправления: