[Jifty-commit] r6914 - jifty/trunk/lib
Jifty commits
jifty-commit at lists.jifty.org
Wed Apr 29 14:33:45 EDT 2009
Author: alexmv
Date: Wed Apr 29 14:33:43 2009
New Revision: 6914
Modified:
jifty/trunk/lib/Jifty.pm
Log:
Basic background process support
Modified: jifty/trunk/lib/Jifty.pm
==============================================================================
--- jifty/trunk/lib/Jifty.pm (original)
+++ jifty/trunk/lib/Jifty.pm Wed Apr 29 14:33:43 2009
@@ -523,6 +523,27 @@
return $app_instance_id;
}
+=head2 background SUB
+
+Forks a background process, and ensures that database connections are
+not shared with the parent process.
+
+=cut
+
+sub background {
+ my $class = shift;
+ my $sub = shift;
+ if (my $pid = fork) {
+ return $pid;
+ } else {
+ close STDOUT;
+ close STDIN;
+ Jifty->setup_database_connection();
+ $sub->();
+ exit;
+ }
+}
+
=head1 SEE ALSO
More information about the Jifty-commit
mailing list