Index: src/FilterEngine.cpp |
=================================================================== |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -175,47 +175,16 @@ |
return jsEngine->Evaluate("API.isAASubscription").Call(*this).AsBool(); |
} |
bool Subscription::operator==(const Subscription& subscription) const |
{ |
return GetProperty("url").AsString() == subscription.GetProperty("url").AsString(); |
} |
-namespace |
-{ |
- class Sync |
- { |
- public: |
- Sync() |
- :initialized(false) |
- { |
- |
- } |
- void Wait() |
- { |
- std::unique_lock<std::mutex> lock(mutex); |
- while (!initialized) |
- cv.wait(lock); |
- } |
- void Set() |
- { |
- { |
- std::unique_lock<std::mutex> lock(mutex); |
- initialized = true; |
- } |
- cv.notify_all(); |
- } |
- private: |
- std::mutex mutex; |
- std::condition_variable cv; |
- bool initialized; |
- }; |
-} |
- |
FilterEngine::FilterEngine(const JsEnginePtr& jsEngine) |
: jsEngine(jsEngine), firstRun(false), updateCheckId(0) |
{ |
} |
void FilterEngine::CreateAsync(const JsEnginePtr& jsEngine, |
const FilterEngine::OnCreatedCallback& onCreated, |
const FilterEngine::CreationParameters& params) |
@@ -295,17 +264,17 @@ |
{ |
FilterEnginePtr retValue; |
Sync sync; |
CreateAsync(jsEngine, [&retValue, &sync](const FilterEnginePtr& filterEngine) |
{ |
retValue = filterEngine; |
sync.Set(); |
}, params); |
- sync.Wait(); |
+ sync.Wait(std::chrono::milliseconds::zero()); |
return retValue; |
} |
namespace |
{ |
typedef std::map<FilterEngine::ContentType, std::string> ContentTypeMap; |
ContentTypeMap CreateContentTypeMap() |