[Tutor] fcntl: Blocking or non-blocking
Tue, 28 Aug 2001 23:09:26 -0700
On Wed, 29 Aug 2001 01:50:18 -0400 (EDT), Ignacio Vazquez-Abrams
<email@example.com> wrote about Re: [Tutor] fcntl: Blocking or
:On Tue, 28 Aug 2001, Sheila King wrote:
:> But I have a concern: what if I try for a blocking call, and the process
:> never acquires the lock? (Maybe I should specify, that these are for CGI
:> scripts, anyhow. So, I guess eventually the process will time out and
:> die.) Should I just code the blocking calls? Or should I code
:> non-blocking and have retries with sleep in there? I can't see any easy
:> way in Python to use the fcntl.lockf command and get a blocking call to
:> time out.
:Blocking in general is Evil unless you know exactly what you're doing.
Well, that leaves me out. I guess that answers that question.
:In fact, it is SO Evil that Unix developed the select() function (replicated in
:the select module) specifically for getting around blocking calls. So I would
:say that you should raise an exception or return None instead of ever
:> Anyone interested in the 50+ messages on this topic in comp.lang.python,
:> can look at the two threads that start with these messages:
:Oh don't worry, it'll keep going strong there too ;)
LOL. Great. Glad to know I haven't tired you out, yet. ;)