On Mon, Mar 8, 2010 at 10:27 AM, Eric Veith1 <eric.ve...@de.ibm.com> wrote:
> "Bob McConnell" <r...@cbord.com> wrote on 03/05/2010 08:22:23 PM:
>> The way I read his problem description, it sounded neither simple nor
>> easy.
>
> Bob, Jay,
>

[snip]

> You see, there's IPC on the local machine and possibly sockets to a remote
> machine.
>

Yes, that's a much clearer picture... ;)

> I'm going pretty well with that right now. :-)
>

Great!


> There's only one thing that concerns me, although I haven't run into any
> problems right now: Safe (aka deferred) vs. immediate signals. When using
> Term::ReadLine to read commands, signals won't be handled until somebody
> at least presses enter. This, however, means that the whole dependency
> system doesn't work as I want it to, because another process isn't killed
> when the first one exits, but after somebody pressed enter. I currently
> circumvent the problem using the "POSIX" package's RT signals, but from
> what I learned from perlipc, these signals aren't safe and can lead to
> corrumption. Now "perlipc" doesn't give a concrete example on that topic.
> I don't want to do much in the signal handler, but there's some work I
> cannot avoid (e.g., flushing command output on SIGTERM, that, in turn, can
> be issued because of a SIGCHLD -- the dependency stuff). Could somebody
> please give me an example in which -- using POSIX RT signals -- work in
> the signal handler is responsible for corruption, or better yet, outline
> when corruption is very likely to happen, and why?
>

It sounds like Term::Readline is using Term::ReadLine::Gnu as the
back-end. The problem there is that, to Perl, the XS call for GNU
readline() looks like a single system call.

Try setting the PERL_RL environment to "Perl" instead of "Gnu":

    use Term::ReadLine;
    $ENV{PERL_RL} = "Perl";
    my $term = Term::ReadLine->new('my term');

You could also just use <> unless you want some special feature of ReadLine.


As for "corruption," you never know. The behavior is undefined and
unpredictable, because you don't know what you're interrupting. The
real danger is that you'll interrupt a malloc call in a way that
causes the perl interpreter to crash and dump core.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.downloadsquad.com  http://www.engatiki.org

values of β will give rise to dom!

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to