comparison Applications/Sdl/BasicSdlApplicationContext.cpp @ 242:092db46c6291 am

improved SDL/Wasm unification
author am@osimis.io
date Wed, 20 Jun 2018 14:20:55 +0200
parents 68856534f005
children 46c5296d867e
comparison
equal deleted inserted replaced
241:a4197519eb55 242:092db46c6291
42 boost::this_thread::sleep(boost::posix_time::milliseconds(that->updateDelay_)); 42 boost::this_thread::sleep(boost::posix_time::milliseconds(that->updateDelay_));
43 } 43 }
44 } 44 }
45 45
46 46
47 BasicSdlApplicationContext::BasicSdlApplicationContext(Orthanc::WebServiceParameters& orthanc, WidgetViewport* centralViewport) : 47 BasicSdlApplicationContext::BasicSdlApplicationContext(OracleWebService& webService) : // Orthanc::WebServiceParameters& orthanc, WidgetViewport* centralViewport) :
48 oracle_(viewportMutex_, 4), // Use 4 threads to download 48 BasicApplicationContext(webService),
49 //oracle_(viewportMutex_, 1), // Disable threading to be reproducible 49 oracleWebService_(&webService),
50 webService_(oracle_, orthanc), 50 // oracle_(viewportMutex_, 4), // Use 4 threads to download
51 centralViewport_(centralViewport), 51 // webService_(oracle_, orthanc),
52 // centralViewport_(centralViewport),
53 centralViewport_(new OrthancStone::WidgetViewport()),
52 stopped_(true), 54 stopped_(true),
53 updateDelay_(100) // By default, 100ms between each refresh of the content 55 updateDelay_(100) // By default, 100ms between each refresh of the content
54 { 56 {
55 srand(time(NULL)); 57 srand(time(NULL));
56 } 58 }
57 59
58 60
59 void BasicSdlApplicationContext::Start() 61 void BasicSdlApplicationContext::Start()
60 { 62 {
61 oracle_.Start(); 63 oracleWebService_->Start();
62 64
63 if (centralViewport_->HasUpdateContent()) 65 if (centralViewport_->HasUpdateContent())
64 { 66 {
65 stopped_ = false; 67 stopped_ = false;
66 updateThread_ = boost::thread(UpdateThread, this); 68 updateThread_ = boost::thread(UpdateThread, this);
75 if (updateThread_.joinable()) 77 if (updateThread_.joinable())
76 { 78 {
77 updateThread_.join(); 79 updateThread_.join();
78 } 80 }
79 81
80 oracle_.Stop(); 82 oracleWebService_->Stop();
81 } 83 }
82 } 84 }