http://www.perlmonks.org?node_id=166571


in reply to Re: Re: Builtin Watchdog for a sub (or block)
in thread Builtin Watchdog for a sub (or block)

I've posted a question on Ask Perl 6 on Use Perl about this: I think that it's wrong to call alarm and fork etc. features of the Perl language, because they are un- or partially- implemented for major platforms like Win32, and I'm hoping that Perl 6 will improve that!

Cheerio!
Osfameron
http://osfameron.perlmonk.org/chickenman

Replies are listed 'Best First'.
Re: (Ask Perl 6: Win32) Re: Re: Re: Builtin Watchdog for a sub (or block)
by Elian (Parson) on May 14, 2002 at 20:43 UTC
    While Parrot may make some of that pain easier to deal with (alarm, for example, though it's got issues anyway once you're running with threads) I don't think you're going to see fork or alarm or whatever go away, and honestly I don't think they should. (And my platform of choice--VMS--doesn't fork, amongst other things)

    It's kind of silly to neuter things so you get a lowest-common-denominator system. Making perl platform independent by taking things away just hurts the people who're on platforms where it does work. (And fork is really unlikely to be completely emulated on Windows, or any other non-unix platform)

      Elian++, I agree actually, I don't want to see fork and alarm go away. I want to see them working on Win32 (and VMS, and MacOS for that matter), even if they only work because they are emulated by the virtual machine on those platforms.

      Having said that, if there could be a way of achieving the functionality without using specific OS calls, that would be 'better', wouldn't it? (in the sense that it would be more portable, therefore a wider base of happy Perl users)

      And if it really can't be done, I want to see the documentation for tasks that use these functions give Win32 equivalents or just admit that it can't be done in Win32. I find it very frustrating following code from a textbook or standard document only to find that it doesn't work (or works buggily). (Yes, you could say that someone could submit patches for documentation: maybe, though this would require some life-priority task realignment...)

      Cheerio!
      Osfameron
      http://osfameron.perlmonk.org/chickenman

        Fork won't work right 100% of the time on windows (or VMS, or MacOS, though it will on OS X) ever. It can't, and there's a limit to how hard it's worth trying. This is documented in the perlfork section of the manual, though whether you'd think to look for it is another matter entirely.

        Whether alarm works on windows is up in the air. Whether it does depends on whether windows has interruptable system calls, which is the big place it's useful.

        Perl has system-dependent behavior, and it's never claimed otherwise. A fair amount of stuff--pretty much everything feasable--is emulated in places where the base functionality's not native, but there's no 100% guarantee. That's not going to change, nor should it. Because of that, it's always a good idea to check the assumptions behind anything you read before trusting them implicitly. (A good rule of thumb generally)