Fix GPU Compile on Linux

mobile_baidu
Yang Yu 8 years ago
parent 1c31bb9459
commit 174050277a

@ -27,11 +27,12 @@ namespace platform {
This wrap is a hack to avoid this bug.
*/
template <class Callable, class... Args>
template <typename Callable, typename... Args>
inline void call_once(std::once_flag& flag, Callable&& f, Args&&... args) {
bool good = false;
std::exception ex;
std::call_once(flag, [&]() {
std::call_once(flag,
[&](Args&&... args) {
try {
f(args...);
good = true;
@ -40,7 +41,8 @@ inline void call_once(std::once_flag& flag, Callable&& f, Args&&... args) {
} catch (...) {
ex = std::runtime_error("excption caught in call_once");
}
});
},
args...);
if (!good) {
throw std::exception(ex);
}

Loading…
Cancel
Save