Haven't tried this but...

Have you looked at using SrmSetWakeupHandler?

You could register a function to:
        Read the serial buffer and copy data to a safe place,
        Send a user message/event to your main loop,
        Re-register and quit
        (Remember this acts like an ISR, and should be as short as possible)

Your main loop can pick up the message and handle the new data, or if you
don't want to have to wait for messages, can poll (eugh) a buffer index
waiting for changes.

Hope this helps,

Greg.

> -----Original Message-----
> From: Steve Stover [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, December 07, 2000 1:27 PM
> To:   Palm Developer Forum
> Subject:      RE: [W]  Multiple Threads under Codewarrior
> 
> Can't do the getevent timeout - I have asynch data coming in an RS-232
> port.
> 
> Looks like this will be a "quick and dirty"...

> 
> Ah, the joys of "real time" code   :)
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of Richard
> Anderson
> Sent: Thursday, December 07, 2000 8:05 AM
> To:   Palm Developer Forum
> Subject:      RE: [W]  Multiple Threads under Codewarrior
> 
> If you setup you main event loop to send nil events at least every second
> (timeout in get event) you can check the time then every five seconds call
> your routine or post yourself an event. Theres lots of stuff about timing
> in
> the archives, but not much in the manuals.
> 
> Rik
> 
> > -----Original Message-----
> > From:       Steve Stover [SMTP:[EMAIL PROTECTED]]
> > Sent:       07 December 2000 17:46
> > To: Palm Developer Forum
> > Subject:    RE: [W]  Multiple Threads under Codewarrior
> >
> > Cool, but...
> >
> > I have a data collection routine that operates at (relatively) long
> > intervals.  It would be nice if I could say
> >     Get Data;
> >     Sleep(5sec)
> >     Repeat
> > And keep it separate from the other code.
> >
> > If I understand your event queue correctly, I still need the main loop
> to
> > calculate timing somehow, and a running (or idling) event loop to handle
> > the
> > special event.  Or is there some way to call a specific event handler
> when
> > needed?  But that wouldn't buy me anything I don't already have.  It's
> the
> > timing calculation that would be simplified in a separate thread, to run
> > different parts of the code at different rates...
> >
> > Am I missing the point?
> <snip>
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to