Re: Function written in C, hangs on one machine and not another...

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Function written in C, hangs on one machine and not another...
Дата
Msg-id 20051028135645.GC26190@svana.org
обсуждение исходный текст
Ответ на Function written in C, hangs on one machine and not another...  (CG <cgg007@yahoo.com>)
Ответы Re: Function written in C, hangs on one machine and not another...  (CG <cgg007@yahoo.com>)
Список pgsql-general
On Fri, Oct 28, 2005 at 06:38:29AM -0700, CG wrote:
> PostgreSQL 7.4 ...
>
> Essentially, I've written a function in C for use with PostgreSQL. The debugger
> shows that the program is hanging on the part of the program that is writing
> data into it's own STDIN.

Umm, what *are* you trying to do? Is this running in the backend?

Firstly, depending on the saize of param_1, the write will block
because it can't write all of it (usually PIPE_BUF). Perhaps recent
kernel versions have changed to make it so no data is accepted until a
reader appears even if the data is smaller than that.

Since apparently you want the read to happen in the same process as the
write, you've just deadlocked yourself. The write won't happen till
someone reads, and the read won't happen because you're stuck
writing...

Finally, this is insane, why would you want to change STDIN?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Marc Andre Paquin
Дата:
Сообщение: Re: Looking for a command to list schemas
Следующее
От: Alex Turner
Дата:
Сообщение: Re: Why database is corrupted after re-booting