Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)
Дата
Msg-id AANLkTimJCK9GrU_qmNrGWZtqg8n92_OBFqHGrNuOCz_i@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
On Fri, Sep 3, 2010 at 9:20 PM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> So we now have the same process nested twice inside a semop() call. Looking
> at the Linux signal (7) man page, it is undefined what happens if semop() is
> re-entered in a signal handler while another semop() call is happening in
> main line of execution. Assuming it somehow works, which semop() call is
> going to return when the semaphore is incremented?
>

Fwiw I wouldn't be too worried about semop specifically. It's a
syscall and will always return with EINTR. What makes functions
async-unsafe is when they might do extra processing manipulating data
structures in user space such as mallocing memory. POSIX seems to be
giving semop license to do that but realistically I can't imagine any
implementation doing so.

What I might wonder about is what happens if the signal is called just
after the semop completes or just before it starts.

And someone mentioned calling elog from within the signal handler --
doesn't elog call palloc() and sprintf? That can't be async-safe.

-- 
greg


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

Предыдущее
От: Max Bowsher
Дата:
Сообщение: Re: git: uh-oh
Следующее
От: Robert Haas
Дата:
Сообщение: Re: lexing small ints as int2