Re: file-locking and postmaster.pid
От | korry |
---|---|
Тема | Re: file-locking and postmaster.pid |
Дата | |
Msg-id | 1148501973.21335.62.camel@sakai.localdomain обсуждение исходный текст |
Ответ на | Re: file-locking and postmaster.pid (Alvaro Herrera <alvherre@commandprompt.com>) |
Ответы |
Re: file-locking and postmaster.pid
|
Список | pgsql-hackers |
<br /><blockquote type="CITE"><pre> <font color="#000000">Certainly on all platforms there must be *some* locking primitive. We</font> <font color="#000000">just need to figure out the appropiate parameters to fcntl() or flock()</font> <font color="#000000">or lockf() on each.</font> </pre></blockquote> Right. <pre> </pre><blockquote type="CITE"><pre> <font color="#000000">The Win32 API for locking seems mighty strange to me.</font> </pre></blockquote><pre> </pre> Linux/Unix byte locking is advisory (meaning that one lock can block another lock, but it can't block a read). Win32locking is mandatory (at least in the most portable form) so a lock blocks a reader. To avoid that problem, youlocka byte that you never intend to read (that is, you lock a byte past the end of the file). Locking past the end-of-fileis portable to all Unix/Linux systems that I've seen (that way, you can lock a region of a file before you growthe file).<br /><br /> -- Korry<br /><br />
В списке pgsql-hackers по дате отправления: