Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Splitting one large timeout into few smaller ones..

by Eyck (Priest)
on Apr 07, 2005 at 18:11 UTC ( [id://445818]=note: print w/replies, xml ) Need Help??


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

Yeah, all of them bring serious problems to the table, Coro supposedly segfaults in multitude of situations.

fork would be nice, but exchanging data between children, moving sockets between then (I have no idea if it's possible to pass SSL socket in any way...) etc is not a trivial task.

And managing a pool of processes is a tedious task, I already asked perlmonks about that,but there were no interesting answers (besides the usual POE fanboy fanfare).

Threads would be in randomly failing department, additionally there are way to many flavors, each with it's own set of problems, advantages and disadvantages.

Anyhoo, I don't need concurrency, if anything, I might use some form of cooperative multitasking, but it may be that there's no such solution outthere

  • Comment on Re^4: Splitting one large timeout into few smaller ones..

Replies are listed 'Best First'.
Re^5: Splitting one large timeout into few smaller ones..
by BrowserUk (Patriarch) on Apr 07, 2005 at 18:29 UTC

    A clearer description of the "tasks" in question, the communications requirements etc. would make it easier to make suggestions.

    Threads would be in randomly failing department, additionally there are way to many flavors, each with it's own set of problems, advantages and disadvantages.

    If we're talking Perl, there are only two flavours and only one of them is worth considering.

    It's not hard to arrange for threads to operate cooperatively--it's quite simple actually--but, in common with all forms of cooperative multitasking, you need to embed yeild points within the loops. If you are able to do this, then you could equally embed return unless $timeleft; at those same points and bottle out when the time has expired and move onto the next task.

    You seem to be hooked on telling us how Perl cannot help you, rather than helping us tell you how it could.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco.
    Rule 1 has a caveat! -- Who broke the cabal?
      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://445818]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-20 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found