chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Concurrency, Blocking I/O


From: Hans Bulfone
Subject: Re: [Chicken-users] Concurrency, Blocking I/O
Date: Mon, 10 Dec 2007 23:09:42 +0100
User-agent: Mutt/1.5.16 (2007-06-09)

hi,

On Sat, Dec 08, 2007 at 11:55:32PM +0200, Moe Aboulkheir wrote:
> Hey,
>
> I've been using Chicken for some time for a variety of things, and am 
> considering using it for a large, upcoming project - one of its components 
> is a database-driven website.  I'm concerned about blocking when performing 
> database access (PostgreSQL or similar) in the lightweight (SRFI-18) 
> threads spawned by Spiffy.  How are you guys dealing with these kinds of 
> issues?  I'd like to hear what everybody has to say.

if the database api provides a non-blocking api it should be possible
to integrate it with the thread scheduler, especially if the database
api also provides access to a filedescriptor for select()ing (which is
done internally by chicken).  postgresql provides both so when using
the postgresql egg database access doesn't block other threads.
(i know because i've stolen this code from the postgresql egg for my
own eggs :)

it's also possible without a file descriptor, but imho one must use
thread-sleep! then (between calls to a polling function provided by
the api) to avoid wasting too much cpu time which introduces a delay.
i once used this technique when i wanted to write an odbc egg.  but
then i found out that most odbc drivers don't seem to support the
non-blocking api anyway, so i didn't finish the egg :(

imho the lightweight threads provided by chicken are a good environment
for network programming.

hth&bye,
hans.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]