[REBOL] Re: wait, events and ports - how they work together ?
From: sags::apollo::lv at: 27-Jul-2006 8:45
I want to clarify it a litle bit more.
So - what to do if I do not want to wait on a port? F.ex. do not wait on
view/layout events? I.e. remove them from wait list:
tmpPrts: system/ports/wait-list clear system/ports/wait-list
do something with other port ... ... wait ser-port
system/ports/wait-list: tmpPrts
Why in case above wait still waits on view/layout events, but when they
happen returns ser-port? (hopefuly I understood right how  my code
works;-)
Janeks
On 25 Jul 2006 at 10:07, Gabriele Santilli wrote:
>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
anevent on a port that is being waited for: >>  2.1) if the port
has no AWAKE function, then  WAIT  returns  the
>  #160 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
returnFALSE). >>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 <gabriele-rebol.com>  --- 
http://www.rebol.com/>Colella Chiara software division ---
http://www.colellachiara.com/ >>-- >To unsubscribe from the list, just send
an email to >lists at rebol.com with unsubscribe as the subject. >