I started to experience some problems when launching a restG4 simulation.
The problem was solved when I modified line 487 from int stat_val;
to int stat_val = 0
.
I dont understand very well why this stat_val
is given by reference to the wait function, and why it was not initiliazed?
Was this bug? What should be the value of stat_val
and why this trick of forking the process was introduced?
470 if (pid == 0) {
471 // writing the geometry object
472 freopen("/dev/null", "w", stdout);
473 freopen("/dev/null", "w", stderr);
474 Console::CompatibilityMode = true;
475
476 TFile* f1 = new TFile(Filename, "update");
477 TGeoManager* geo2 = gdml->CreateGeoM();
478
479 f1->cd();
480 geo2->SetName("Geometry");
481 geo2->Write();
482 f1->Close();
483 exit(0);
484 }
485 // father process
486 else {
487 int stat_val = 0;
488 pid_t child_pid;
489
490 printf("Writing geometry ... \n");
491
492 child_pid = wait(&stat_val);
493
494 printf("Geometry writting process exited, pid = %d, Code %d\n", child_pid, WEXITSTATUS(stat_val));
495 if (WEXITSTATUS(stat_val) != 0) printf("REST Error: geometry writting is abnormal!\n");
496 }