Mercurial > hg > orthanc-stone
comparison Applications/Generic/NativeStoneApplicationRunner.cpp @ 431:26b90b110719 am-vsol-upgrade
added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
author | am@osimis.io |
---|---|
date | Thu, 29 Nov 2018 19:25:15 +0100 |
parents | c23df8b3433b |
children | a750f11892ec |
comparison
equal
deleted
inserted
replaced
430:b85f635f1eb5 | 431:26b90b110719 |
---|---|
25 | 25 |
26 #include "NativeStoneApplicationRunner.h" | 26 #include "NativeStoneApplicationRunner.h" |
27 | 27 |
28 #include "../../Framework/Toolbox/MessagingToolbox.h" | 28 #include "../../Framework/Toolbox/MessagingToolbox.h" |
29 #include "../../Platforms/Generic/OracleWebService.h" | 29 #include "../../Platforms/Generic/OracleWebService.h" |
30 #include "../../Platforms/Generic/OracleDelayedCallExecutor.h" | |
30 #include "NativeStoneApplicationContext.h" | 31 #include "NativeStoneApplicationContext.h" |
31 | 32 |
32 #include <Core/Logging.h> | 33 #include <Core/Logging.h> |
33 #include <Core/HttpClient.h> | 34 #include <Core/HttpClient.h> |
34 #include <Core/Toolbox.h> | 35 #include <Core/Toolbox.h> |
186 LogStatusBar statusBar; | 187 LogStatusBar statusBar; |
187 | 188 |
188 NativeStoneApplicationContext context(broker_); | 189 NativeStoneApplicationContext context(broker_); |
189 | 190 |
190 { | 191 { |
191 Oracle oracle(4); // use 4 threads to download content | 192 Oracle oracle(6); // use multiple threads to execute asynchronous tasks like download content |
192 oracle.Start(); | 193 oracle.Start(); |
193 | 194 |
194 { | 195 { |
195 OracleWebService webService(broker_, oracle, webServiceParameters, context); | 196 OracleWebService webService(broker_, oracle, webServiceParameters, context); |
196 context.SetWebService(webService); | 197 context.SetWebService(webService); |
197 context.SetOrthancBaseUrl(webServiceParameters.GetUrl()); | 198 context.SetOrthancBaseUrl(webServiceParameters.GetUrl()); |
199 | |
200 OracleDelayedCallExecutor delayedExecutor(broker_, oracle, context); | |
201 context.SetDelayedCallExecutor(delayedExecutor); | |
198 | 202 |
199 application_.Initialize(&context, statusBar, parameters); | 203 application_.Initialize(&context, statusBar, parameters); |
200 | 204 |
201 { | 205 { |
202 NativeStoneApplicationContext::GlobalMutexLocker locker(context); | 206 NativeStoneApplicationContext::GlobalMutexLocker locker(context); |