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?
> 
> Steve Stover
> SRC
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of Richard
> Anderson
> Sent: Thursday, December 07, 2000 7:27 AM
> To:   Palm Developer Forum
> Subject:      RE: [W]  Multiple Threads under Codewarrior
> 
> Hi, I do it like this, not sure its the best way, buts it neat and it
> works.
> 
> typedef enum {                                        /* User defined
> events */
> userReadPort = firstUserEvent,
> userValidMsg,
> userRadioBattLow,
> userVectorRedraw,
> userModeChange
> } user_eventsEnum;
> 
> 
> EventType user_event;
> /* Post our own event to the queue */
> user_event.eType = (eventsEnum)userRadioBattLow;
> /* Add other paremeters here */
> EvtAddEventToQueue (&user_event);
> 
> 
> Get the event as any other palm event.
> 
> Rik
> > -----Original Message-----
> 
> > From:       Jason Partyka [SMTP:[EMAIL PROTECTED]]
> > Sent:       07 December 2000 15:10
> > To: Palm Developer Forum
> > Subject:    RE: [W]  Multiple Threads under Codewarrior
> >
> > By user defined messages you mean user-defined events, right? I haven't
> > figured out a way to include data with user-defined events, although
> that
> > may be due to limited experience in C. Is such a thing possible on the
> > Palm, and if so, can someone point me to documentation on how to do so?
> <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