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

[REBOL] Re: wait, events and ports - how they work together ?

From: gabriele::colellachiara::com at: 25-Jul-2006 10:07

Hi Janeks, On Monday, July 24, 2006, 10:10:16 PM, you wrote: sal> problem: sal> I have serial port functions that finaly works well in non gui way. sal> When I add layouts then the "wait serial-port" stops and waits on an sal> event of view/layout. A little background on how WAIT works: 1) you can think of WAIT as doing something like: wait: func [ports [block!]] [ internal-wait join system/ports/wait-list ports ] (just showing the block of ports case for simplicity). So this means that to wait on a port, either you pass it to WAIT or you put it in the wait list. A port that is in the wait list is always waited for every time you use WAIT. 2) when there is an event on a port that is being waited for: 2.1) if the port has no AWAKE function, then WAIT returns the port. 2.2) if the port has an AWAKE function, this function is called; if it returns true, WAIT returns the port; if it returns false, WAIT continues waiting. Note that in the current implementation only the value FALSE makes WAIT continue waiting, any other value will make it return (i.e. it doesn't consider NONE to be equivalent to FALSE, you have to explicitly return FALSE). In your case I'd just suggest to add your sms-port to the wait list and set an awake function for it. Awake functions take one argument, the port that got the event (so you can use the same function on many ports; in your case you don't care about this). Regards, Gabriele. -- Gabriele Santilli <> --- Colella Chiara software division ---