Changeset 24847 for gs2-extensions/parallel-building/trunk/src
- Timestamp:
- 2011-12-01T12:33:53+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/parallel-building/trunk/src/bin/script/GDBMServer.pl
r24679 r24847 297 297 $server = SocketsSwimmingThreadPoolServer->new(host=>$host, 298 298 port=>$port, 299 main_cb => \&exitCheck, 299 300 processor_cb => \&process); 300 301 … … 351 352 } 352 353 exit(0); 354 355 # @function exitCheck 356 # A callback function, called every 5 seconds (default) by the socket server, 357 # to see whether the parent process (by pid) is actually still running. This 358 # will cover the case where the parent process (import.pl or build.pl) dies 359 # without properly asking the server to shutdown. 360 sub exitCheck 361 { 362 my $counter = shift @_; 363 # note: kill, when passed a first argument of 0, checks whether it's possible 364 # to send a signal to the pid given as the second argument, and returns true 365 # if it is. Thus it provides a means to determine if the parent process is 366 # still running (and hence can be signalled) In newer versions of Perl 367 # (5.8.9) it should even work cross-platform. 368 if (!kill(0, $parent_pid)) 369 { 370 print " * Parent processs gone away... forcing server shutdown\n"; 371 $server->stop; 372 if ($debug) 373 { 374 lock($debug_log); 375 $|++; 376 print "[" . time() . "|MAIN] Parent process gone away... forcing server shutdown.\n\n"; 377 $|--; 378 } 379 } 380 } 353 381 354 382 # /** @function process
Note:
See TracChangeset
for help on using the changeset viewer.