[REBOL] Re: using 'wait with your own port handler?
From: holger:rebol at: 25-Jun-2001 15:31
On Sun, Jun 24, 2001 at 09:24:51PM +0200, Martin Johannesson wrote:
> This all seems to work, EXCEPT for 'wait. So, my question is this: Is it
> at all possible to write your own port handler that you can wait for using
> 'wait?
The short answer is no. There are two issues:
- How do you get REBOL to "wake up" when your library is done
playing ? This is the difficult part and always OS-dependent. For Windows
there would, e.g., have to be a way for a script to allocate a WinMsg,
register it with REBOL's internal wait handler, and tie it to a port.
For other operating systems the procedure would be different. Not
supported at this time.
- How do you get 'wait to realize that your port is done ? This
will be possible in the next major Core release.
At the moment only two types of ports can have 'wait functionality: ports
with port handlers written in C, and ports which are directly based on ports
that have 'wait functionality. For instance you can 'wait for an http port
because it uses a tcp port that supports 'wait. Port handlers have a
function 'get-sub-port which is supposed to return the next-lower port.
The default behavior (used by http) is to return port/sub-port, i.e. for
http the tcp port is returned.
> If so, how would I do that? I've used the make root-protocol
> approach and I can't really figure it out. I tried using 'wait on my
> port, just to see what would happen, and it crashed REBOL. :-)
That should not happen...
--
Holger Kruse
[holger--rebol--com]