> "Piers Cawley" <[EMAIL PROTECTED]> wrote
> > Threads and Progress Monitors
> > Dave Whipp had some more thread questions, and wondered what would be
> a
> > good Perl 6ish way of implementing a threaded progress monitor. Whilst
> > the discussion of all this was interesting, I'm not sure that it's
> > really much to do with the language, more something that one would
> > implement according to taste and the particular requirements of a
> given
> > project.
>
> A quick summary of what came out of it:
>
> On the basis that perl makes simple things simple, we drilled down on the
> example of a simple progress monitor. This morphed into the question of how
> to implement a timeout:
>
> sub slow
> {
> TIMEOUT(60) { throw TimeoutException }
> # TIMEOUT(60) { return undef but reason("timeout") }
> ... # slow stuff, maybe calls out to 3rd-party code
> return ...;
> }
>
> The implementation of the TIMEOUT macro proposed a Timer object. It was
> _assumed_ that Perl6 would provide a signaling mechanism to allow such timer
> objects to be implemented. $SIG{ALRM} probably isn't sufficient -- perhaps
> timers will actually be parrot-level concepts. Precisely how such a
> mechanism would work is unresolved.
I think it would fall trivially out of the events mechanism, which is
planned for Parrot.
Luke
> Second, it requires the timeout block to be able to kill off the mainline of
> execution, but in a way that cleans up nicely and allows execution to resume
> at the caller of the timed-out block. The more general case is that one
> thread may wish to inject an exception into another -- again, this assumes
> some form of inter-thread signaling machanism.
>
>
> Dave.