| 25 | static std::mutex l_ApiScriptMutex; |
| 26 | |
| 27 | static void ScriptFrameCleanupHandler() |
| 28 | { |
| 29 | std::unique_lock<std::mutex> lock(l_ApiScriptMutex); |
| 30 | |
| 31 | std::vector<String> cleanup_keys; |
| 32 | |
| 33 | for (auto& kv : l_ApiScriptFrames) { |
| 34 | std::unique_lock frameLock(kv.second->Mutex, std::try_to_lock); |
| 35 | if (!frameLock) { |
| 36 | // If the frame is locked, it's in use, don't expire it this time. |
| 37 | continue; |
| 38 | } |
| 39 | |
| 40 | if (kv.second->Seen < Utility::GetTime() - 1800) |
| 41 | cleanup_keys.push_back(kv.first); |
| 42 | } |
| 43 | |
| 44 | for (const String& key : cleanup_keys) |
| 45 | l_ApiScriptFrames.erase(key); |
| 46 | } |
| 47 | |
| 48 | static void EnsureFrameCleanupTimer() |
| 49 | { |
no test coverage detected