Hi all,<br><br>I would like to know the consequence in using alarm and die in a perl-handler.<br>For example consider this <br><a href="http://wiki.codemongers.com/NginxEmbeddedPerlImageResize">http://wiki.codemongers.com/NginxEmbeddedPerlImageResize</a><br>
<br>The blocking code is the following<br><br clear="all"><pre> $image= new Image::Magick;<br><span class="anchor" id="line-97"></span> $image->Read($real_file_path);<br><span class="anchor" id="line-98"></span> $image->Scale($dimensions);<br>
<span class="anchor" id="line-99"></span> $image->Write($dest_file);<br><br><br></pre>Sometimes this code can hold all resources and normal requests cannot be served.<br><br>So if I follow the example from mod_perl and die in 2 seconds, what will be the consequence to the current requests?<br>
<br><pre class="code"><a name="pmodperl-CHP-6-ITERM-4590">my $timeout = 2; # seconds<br>eval {<br> local $SIG{ALRM} =<br> sub { die "Sorry, timed out. Please try again\n" };<br> alarm $timeout;<br> # the operation listed above<br>
alarm 0;<br>};<br><br><br>die $@ if $@;</a></pre><br><br>-- <br>best regards<br>Atif Ghaffar<br>