in reply to Re^5: Splitting one large timeout into few smaller ones..
in thread Splitting one large timeout into few smaller ones..

Which threads flavour is worth considering?

I don't know how to ask this in more clear way, but my whole post was about embedding those yield points within the loops, that is exactly what I'm trying to do.

As you say, it's supposed to be simple, but I'm having problems with figuring this one out. If it's not clear from the way I tried to phrase the question, then where do you think I made the mistake?

As to 'return unless $timeleft', that would be exactly the opposite of what I'm trying to do.

$sth->stuff(); #NOT return unless $timeleft; #if i'm here, I do not need to return, I can go on
Sth like
local $SIG{ALRM}=sub { return; #IE, when ALRM strikes # cut short execution of the routine and just return from #there }; alarm 10;# $sth->stuff(); alarm 0;# if I'm here, I can safely continue
Or maybe
sub sth($$) { $SIG{ALRM}=sub { goto SUBEND; #IE, when ALRM strikes # cut short execution of the routine and just return from #there }; #.... #.... alarm 10;# $sth->stuff(); alarm 0;# if I'm here, I can safely continue SUBEND: return; }
However, using goto seems ugly, and putting return; inside SIG{ALRM} shouldn't work.

I'm asking if there's a way to make this work.