Re: Trying to understand signals and restartable system calls

2004-03-21 Thread drieux
On Mar 21, 2004, at 8:55 AM, Mark Alldritt wrote: [..] I take if from your responses that Perl doesn't automatically restart system calls after a signal is processed as Programming Perl and the Perl Cookbook suggest it does. I don't actually own the code that is doing the read, so its not easy

B/C - Re: Trying to understand signals and restartable system calls

2004-03-21 Thread drieux
On Mar 19, 2004, at 1:31 PM, Joel wrote: I'll toss in my two cents here, since I've done something like this before in a production-type environment. IMHO, The best thing to do would be to have your signal handler set a flag (in the manner described by drieux) and have your loop react to that

Trying to understand signals and restartable system calls

2004-03-19 Thread Mark Alldritt
Hello, I'm trying to understand how signals and restartable system calls interact. Take this example: #!/usr/bin/perl $SIG{USR2} = sub { print Here I Am\n; }; print Starting...\n; my $abc; while (read STDIN, $abc, 20) { print $abc\n; } print Done\n; If I run this script and then send a

Re: Trying to understand signals and restartable system calls

2004-03-19 Thread Ken Williams
On Mar 19, 2004, at 11:34 AM, Mark Alldritt wrote: Hello, I'm trying to understand how signals and restartable system calls interact. Take this example: #!/usr/bin/perl $SIG{USR2} = sub { print Here I Am\n; }; print Starting...\n; my $abc; while (read STDIN, $abc, 20) { print $abc\n; }

Re: Trying to understand signals and restartable system calls

2004-03-19 Thread drieux
On Mar 19, 2004, at 9:34 AM, Mark Alldritt wrote: Hello, I'm trying to understand how signals and restartable system calls interact. Take this example: #!/usr/bin/perl $SIG{USR2} = sub { print Here I Am\n; }; print Starting...\n; my $abc; while (read STDIN, $abc, 20) { print $abc\n; }

Re: Trying to understand signals and restartable system calls

2004-03-19 Thread Joel
Hi folks, I'll toss in my two cents here, since I've done something like this before in a production-type environment. IMHO, The best thing to do would be to have your signal handler set a flag (in the manner described by drieux) and have your loop react to that flag when it changes. This is a