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

[REBOL] A couple of things regarding ports Re:(3)

From: al:bri:xtra at: 18-Sep-2000 21:00

malte wrote:
> Im also making a multi-connection app, and had the same problems, however,
I don't get things to work with dispatch either..
> perhaps Im not using it properly.. syntax, anyone? :) > > right now I go like > port: dispatch [port1 port2] > > wrong?
Yes. That's wrong. Have a look at the source for 'dispatch:
>> source dispatch
dispatch: func [ {Wait for a block of ports. As events happen, dispatch port handler blocks.} port-block [block!] {Block of port handler pairs (port can be timeout too).} /local ports awake timeblk result ][ ports: copy [] foreach [port job] port-block: reduce port-block [ if any [number? port time? port] [if none? timeblk [timeblk: :job]] append ports port ] forever [ either awake: wait/all ports [ if foreach item awake [ set/any 'result do select port-block item item if all [value? 'result 'break = :result] [break/return true] ] [break] ] [do :timeblk] ] ] Note the 'foreach: foreach [port job] port-block There's a job after each port value. Try: dispatch [port1 Port1Handler port2 Port2Handler] and have: Port1Handler: func [... etc. I hope that helps! Andrew Martin ICQ: 26227169 http://members.ncbi.com/AndrewMartin/ http://members.xoom.com/AndrewMartin/