Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: using an event to periodically check a pop server for email.

From: arolls:bigpond:au at: 27-Jun-2001 2:19

You could launch another rebol process each 120 seconds to do the work? or Split your work up into several parts. Increase your rate to about 1, so that the work gets done in a reasonable time. Maintain two variables: job-part: 0 ; stores which part of the job you are up to. counter: 0 ; counts up to 120 seconds So, as each 'time event comes along, increment counter until it gets to 120 seconds worth. When 120, fire up your job by incrementing job-part up to the maximum of jobs. if non-zero, do the job indicated by job-part. Kind of a state machine. Hang on, code is easier:-) ; assuming rate 1 if evt = 'time [ if 120 = counter: counter + 1 [ counter: 0 ; reset the counter ; start the job (starting with the first part). job-part: 1 ] switch job-part compose [ 0 [] ; do nothing 1 [ ; read email here job-part: job-part + 1 ] 2 [ ; parse through each email here ; (maintain a second job-part counter ; here to process each email) job-part: job-part + 1 ] 3 [ ; send each email here ; (maintain that second job-part counter ; again to process each email) job-part: job-part + 1 ] 4 [ ; do last part here job-part: 0 ; we are finished ] ] ] or Perhaps you can just insert [wait none] between your job parts. (Just be sure to avoid infinite loop. Use a flag to indicate that your job is in progress). Anton.