| 122 | return fRet; |
| 123 | } |
| 124 | std::tuple<bool, boost::thread*> RunCoin(int argc, char* argv[]) { |
| 125 | boost::thread* detectShutdownThread = nullptr; |
| 126 | static boost::thread_group threadGroup; |
| 127 | SetupEnvironment(); |
| 128 | |
| 129 | bool fRet = AppInit(argc, argv, threadGroup); |
| 130 | |
| 131 | detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup)); |
| 132 | |
| 133 | if (!fRet) { |
| 134 | if (detectShutdownThread) |
| 135 | detectShutdownThread->interrupt(); |
| 136 | Interrupt(); |
| 137 | threadGroup.interrupt_all(); |
| 138 | |
| 139 | // threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of |
| 140 | // the startup-failure cases to make sure they don't result in a hang due to some |
| 141 | // thread-blocking-waiting-for-another-thread-during-startup case |
| 142 | } |
| 143 | return std::make_tuple(fRet, detectShutdownThread); |
| 144 | } |
| 145 | |
| 146 | int main(int argc, char* argv[]) { |
| 147 | std::tuple<bool, boost::thread*> ret = RunCoin(argc, argv); |
no test coverage detected