Re: message type 0x50

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: message type 0x50
Дата
Msg-id 87r82o1qco.fsf@stark.dyndns.tv
обсуждение исходный текст
Ответ на message type 0x50  (Alessandro GARDICH <gremlin@gremlin.it>)
Список pgsql-general
Alessandro GARDICH <gremlin@gremlin.it> writes:

> the program is quite simple, a loop do UPDATE on a random entry on a
> table. Server is without autocommit.
>
> with setittimer and SIGALRM i do an explicit COMMIT every 10 seconds,
> update loop have a random delay from 0 to 500 msec using usleep().

I don't know the full answer to your question, but I don't think it's safe to
call libpq functions from signals handlers. It's not really safe to do much of
anything in signal handlers in fact. Even functions like printf() and malloc()
aren't technically safe to call from signal handlers.

What you should probably do is set a flag that you check upon completion of
the usleep() or after every update, and handle the commit there.

--
greg

В списке pgsql-general по дате отправления:

Предыдущее
От: "D. Stimits"
Дата:
Сообщение: Re: C API, PQconnectdb and options Q.
Следующее
От: Brian Hirt
Дата:
Сообщение: Re: Picture with Postgres and Delphi