[Tutor] fcntl: Blocking or non-blocking

Sheila King sheila@thinkspot.net
Tue, 28 Aug 2001 23:09:26 -0700


On Wed, 29 Aug 2001 01:50:18 -0400 (EDT), Ignacio Vazquez-Abrams
<ignacio@openservices.net>  wrote about Re: [Tutor] fcntl: Blocking or
non-blocking:

: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
:blocking.

 
:> Anyone interested in the 50+ messages on this topic in comp.lang.python,
:> can look at the two threads that start with these messages:
:>
:> http://groups.google.com/groups?q=hl=en&selm=djsfotomogdeba70gp1cuogjbt5ii3chrb%404ax.com
:>
:> http://groups.google.com/groups?hl=en&selm=bo2ootg61vmposfvsg8gvrks6eqiuss940%404ax.com
:
:Oh don't worry, it'll keep going strong there too ;)

LOL. Great. Glad to know I haven't tired you out, yet. ;)


--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/