void LightSpeed::AppBase::handleException() { try { try { throw; #if defined _DEBUG || defined DEBUG } catch (const Exception &e) { exceptionDebugLog(e); } catch (const std::exception &e) { exceptionDebugLog(StdException(THISLOCATION,e)); } catch (...) { exceptionDebugLog(UnknownException(THISLOCATION)); #else } catch (const Exception &e) { onException(e); } catch (const std::exception &e) { onException(StdException(THISLOCATION,e)); } catch (...) { onException(UnknownException(THISLOCATION)); #endif } } catch (const Exception &e) { IApp::exceptionDebug(e,this); } catch (const std::exception &e) { IApp::exceptionDebug(StdException(THISLOCATION,e),this); } catch (...) { IApp::exceptionDebug(UnknownException(THISLOCATION),this); } }
static void *fuse_service_init () { try { // Termination signals are handled by a separate process to allow clean dismount on shutdown struct sigaction action; Memory::Zero (&action, sizeof (action)); action.sa_handler = SIG_IGN; sigaction (SIGINT, &action, nullptr); sigaction (SIGQUIT, &action, nullptr); sigaction (SIGTERM, &action, nullptr); if (!EncryptionThreadPool::IsRunning()) EncryptionThreadPool::Start(); } catch (exception &e) { SystemLog::WriteException (e); } catch (...) { SystemLog::WriteException (UnknownException (SRC_POS)); } return nullptr; }
void LinuxNetworkEventListener::workerProc() { while (!Thread::canFinish()) { try { PollBase::Result res; PollBase::WaitStatus wt = fdSelect.wait(nil, res); if (wt == PollBase::waitWakeUp) { while (pumpMessage()); } else { AutoArray<std::pair<ISleepingObject *, natural>,SmallAlloc<32> > tocall; SysTime tm = SysTime::now(); FdData *listeners = reinterpret_cast<FdData *>(res.userData); for (ListenerMap::Iterator iter = listeners->listeners.getFwIter(); iter.hasItems();) { const FdListener &l = iter.peek(); if (res.flags & l.waitMask) { tocall.add(std::make_pair(l.notify,res.flags & l.waitMask)); listeners->listeners.erase(iter); // l.notify->wakeUp(con.waitMask & l.waitMask); } else if (l.waitTimeout.expired(tm)) { tocall.add(std::make_pair(l.notify,0)); listeners->listeners.erase(iter); // l.notify->wakeUp(0); } else { iter.skip(); } } updateFdData(listeners,res.fd); for (natural i = 0; i < tocall.length(); i++) { tocall[i].first->wakeUp(tocall[i].second); } } } catch (const Exception &e) { AppBase::current().onThreadException(e); } catch (const std::exception &e) { AppBase::current().onThreadException(StdException(THISLOCATION,e)); } catch (...) { AppBase::current().onThreadException(UnknownException(THISLOCATION)); } } fdSelect.cancelAll(CleanUpProc(this)); /* fdSelect.dropAll(); while (fdSelect.hasItems()) { const LinuxFdSelect::FdInfo &con = fdSelect.getNext(); FdData *listeners = reinterpret_cast<FdData *>(con.data); if (listeners) delete listeners; fdSelect.unset(con.fd); } */ }
void LinuxNetworkEventListener::RequestMsg::run() throw() { try { owner.doRequest(r); } catch (const Exception &e) { AppBase::current().onThreadException(e); } catch (const std::exception &e) { AppBase::current().onThreadException(StdException(THISLOCATION,e)); } catch (...) { AppBase::current().onThreadException(UnknownException(THISLOCATION)); } }
static void fuse_service_destroy (void *userdata) { try { FuseService::Dismount(); } catch (exception &e) { SystemLog::WriteException (e); } catch (...) { SystemLog::WriteException (UnknownException (SRC_POS)); } }
int FuseService::ExceptionToErrorCode () { try { throw; } catch (std::bad_alloc) { return -ENOMEM; } catch (ParameterIncorrect &e) { SystemLog::WriteException (e); return -EINVAL; } catch (VolumeProtected&) { return -EPERM; } catch (VolumeReadOnly&) { return -EPERM; } catch (SystemException &e) { SystemLog::WriteException (e); return -static_cast <int> (e.GetErrorCode()); } catch (std::exception &e) { SystemLog::WriteException (e); return -EINTR; } catch (...) { SystemLog::WriteException (UnknownException (SRC_POS)); return -EINTR; } }