void LLApp::commonCtor() { // Set our status to running setStatus(APP_STATUS_RUNNING); LLCommon::initClass(); #if !LL_WINDOWS // This must be initialized before the error handler. sSigChildCount = new LLAtomicU32(0); #endif // Setup error handling setupErrorHandling(); // initialize the options structure. We need to make this an array // because the structured data will not auto-allocate if we // reference an invalid location with the [] operator. mOptions = LLSD::emptyArray(); LLSD sd; for(int i = 0; i < PRIORITY_COUNT; ++i) { mOptions.append(sd); } // Set the application to this instance. sApplication = this; }
pid_t LLApp::fork() { fflush(NULL); // flush all buffers before the child inherits them pid_t pid = ::fork(); if( pid < 0 ) { int system_error = errno; llwarns << "Unable to fork! Operating system error code: " << system_error << llendl; } else if (pid == 0) { // Sleep a bit to allow the parent to set up child callbacks. ms_sleep(10); // We need to disable signal handling, because we don't have a // signal handling thread anymore. setupErrorHandling(); } else { llinfos << "Forked child process " << pid << llendl; } return pid; }
LLApp::LLApp() : mThreadErrorp(NULL) { // Set our status to running setStatus(APP_STATUS_RUNNING); LLCommon::initClass(); #if !LL_WINDOWS // This must be initialized before the error handler. sSigChildCount = new LLAtomicU32(0); #endif // Setup error handling setupErrorHandling(); // initialize the options structure. We need to make this an array // because the structured data will not auto-allocate if we // reference an invalid location with the [] operator. mOptions = LLSD::emptyArray(); LLSD sd; for(int i = 0; i < PRIORITY_COUNT; ++i) { mOptions.append(sd); } // Make sure we clean up APR when we exit // Don't need to do this if we're cleaning up APR in the destructor //atexit(ll_cleanup_apr); // Set the application to this instance. sApplication = this; }