chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Signal woes.


From: Thomas Christian Chust
Subject: Re: [Chicken-users] Signal woes.
Date: Sun, 22 Jul 2007 15:54:26 +0200
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.4) Gecko/20070509 SeaMonkey/1.1.2

felix winkelmann wrote:

> On 7/21/07, Robin Lee Powell <address@hidden> wrote:
>
>> I have an app that uses a couple of C libraries.  The general
>> problem I'm trying to solve is providing status updates to the user
>> in a timely fashion (ideally, about 750ms).
>> [...]
> [...]
> I can't think of anything besides running a second (native) thread,
> if you're into that sort of thing... Or splitting the application into
> multiple
> processes (say, one for UI/status display and one for the guts).
> [...]

Hello,

I've never done serious development with curses so far, but shouldn't it
be possible to run a select system call on the descriptor representing
the terminal device and to provide a timeout for that call?

If you set up a loop that

 * selects the terminal device for input with a timeout
 * checks upon return from select whether the timeout expired or
   the terminal is ready for input
 * calls wgetch if the terminal is ready for input OR
 * updates the status display if the timeout expired

then this should work just fine unless you run multiple threads reading
input from the same terminal concurrently.

Unfortunately, CHICKEN apparently doesn't support subsecond resolution
for file-select. But the select system call usually does support that
such that it should easily be possible to implement for example a
wrapper for wgetch as a foreign-lambda* which does the appropriate
timeout handling and returns #f in case of timeout.

cu,
Thomas




reply via email to

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