Re: [RFC PATCHv2 09/10] gitweb/cache.pm - Regenerate (refresh) cache in background

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Feb 2010, Jakub Narebski wrote:

[...]
> +               my $pid = fork() if ($data && $self->get_background_cache());
> +               if (!defined $pid || $pid) {
> +                       # parent, or didn't fork
> +                       $data = $p_coderef->($self, $p_key);
> +                       $self->set($p_key, $data);
> +
> +                       if ($pid) {
> +                               # releases lock before waiting and exiting
> +                               close $lock_fh;
> +                               # wait for child (which would print) and exit
> +                               waitpid $pid, 0;
> +                               exit 0;
> +                       }
> +               } else {
> +                       # child is to serve stale data
> +                       return $data;
> +               }
[...]

I have decide to rely on $SIG{CHLD} = 'IGNORE' to not generate zombies,
and consistently exit in child (in forked process) and return in parent.
This change would be in next version of this series.

-- 
Jakub Narebski
Poland
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]