| 44 | thread_local const char* ThreadLabel::value_ = ""; |
| 45 | |
| 46 | void WarnIfInCallback(std::function<void()> f) { |
| 47 | const char* label = ThreadLabel::GetValue(); |
| 48 | if (label && !strcmp(label, "gpu_event_mgr")) { |
| 49 | if (f) { |
| 50 | f(); |
| 51 | } else { |
| 52 | LOG(WARNING) << "Executing inside EventMgr callback thread: " |
| 53 | << CurrentStackTrace(); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | void InitThreadpoolLabels(thread::ThreadPool* threadpool) { |
| 59 | static const char* label = "gpu_event_mgr"; |