14 #include "./logging.h"
23 inline std::vector<std::string>
Split(
const std::string& s,
char delim) {
25 std::istringstream is(s);
26 std::vector<std::string> ret;
27 while (std::getline(is, item, delim)) {
38 std::hash<T> hash_func;
39 return key ^ (hash_func(value) + 0x9e3779b9 + (key << 6) + (key >> 2));
47 return key ^ (value + 0x9e3779b9 + (key << 6) + (key >> 2));
56 std::exception_ptr omp_exception_;
64 template <
typename Function,
typename... Parameters>
65 void Run(Function f, Parameters... params) {
68 }
catch (dmlc::Error &ex) {
69 std::lock_guard<std::mutex>
lock(mutex_);
70 if (!omp_exception_) {
71 omp_exception_ = std::current_exception();
73 }
catch (std::exception &ex) {
74 std::lock_guard<std::mutex>
lock(mutex_);
75 if (!omp_exception_) {
76 omp_exception_ = std::current_exception();
85 if (this->omp_exception_) std::rethrow_exception(this->omp_exception_);
91 #endif // DMLC_COMMON_H_