Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
69475ba5
Commit
69475ba5
authored
Nov 18, 2009
by
Sebastian Eichelbaum
Browse files
[CHANGE] - the GUI now offers a condition variable for isInitialized- flag
parent
cffe6b28
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
8 deletions
+28
-8
src/gui/WGUI.cpp
src/gui/WGUI.cpp
+8
-1
src/gui/WGUI.h
src/gui/WGUI.h
+15
-1
src/gui/qt4/WQt4Gui.cpp
src/gui/qt4/WQt4Gui.cpp
+1
-0
src/kernel/WKernel.cpp
src/kernel/WKernel.cpp
+2
-4
src/modules/coordinateSystem/WMCoordinateSystem.cpp
src/modules/coordinateSystem/WMCoordinateSystem.cpp
+1
-1
src/modules/navSlices/WMNavSlices.cpp
src/modules/navSlices/WMNavSlices.cpp
+1
-1
No files found.
src/gui/WGUI.cpp
View file @
69475ba5
...
...
@@ -22,6 +22,8 @@
//
//---------------------------------------------------------------------------
#include "../common/WConditionOneShot.h"
#include "WGUI.h"
WGUI
::
WGUI
(
int
argc
,
char
**
argv
)
:
boost
::
enable_shared_from_this
<
WGUI
>
()
...
...
@@ -36,11 +38,16 @@ WGUI::~WGUI()
{
}
bool
WGUI
::
isInitalized
()
bool
WGUI
::
isInit
i
alized
()
const
{
return
m_isInitialized
;
}
const
WCondition
&
WGUI
::
waitInitialized
()
const
{
return
m_isInitializedCondition
;
}
void
WGUI
::
slotAddDatasetToBrowser
(
boost
::
shared_ptr
<
WModule
>
module
)
{
addDatasetToBrowser
(
module
,
0
);
...
...
src/gui/WGUI.h
View file @
69475ba5
...
...
@@ -31,6 +31,8 @@
#include <boost/shared_ptr.hpp>
#include "../common/WThreadedRunner.h"
#include "../common/WCondition.h"
#include "../common/WConditionOneShot.h"
#include "../kernel/WModule.h"
#include "qt4/signalslib.hpp"
...
...
@@ -71,7 +73,14 @@ public:
*
* \return true if initialized.
*/
virtual
bool
isInitalized
();
virtual
bool
isInitialized
()
const
;
/**
* Gives other threads the possibility to wait for this condition to come true.
*
* \return Reference to the condition.
*/
virtual
const
WCondition
&
waitInitialized
()
const
;
/**
* Runs the GUI. All initialization should be done here.
...
...
@@ -114,6 +123,11 @@ protected:
*/
bool
m_isInitialized
;
/**
* Condition should be fired when "isInitialized" got true.
*/
WConditionOneShot
m_isInitializedCondition
;
/**
* Number of command line arguments given.
*/
...
...
src/gui/qt4/WQt4Gui.cpp
View file @
69475ba5
...
...
@@ -75,6 +75,7 @@ int WQt4Gui::run()
// now we are initialized
m_isInitialized
=
true
;
m_isInitializedCondition
.
notify
();
// run
// NOTE: kernel shutdown is implemented in WMainWindow
...
...
src/kernel/WKernel.cpp
View file @
69475ba5
...
...
@@ -36,6 +36,7 @@
#include "WModule.h"
#include "WModuleFactory.h"
#include "../common/WException.h"
#include "../common/WCondition.h"
#include "../graphicsEngine/WGraphicsEngine.h"
...
...
@@ -126,10 +127,7 @@ void WKernel::threadMain()
WLogger
::
getLogger
()
->
addLogMessage
(
"Starting Kernel"
,
"Kernel"
,
LL_DEBUG
);
// wait for GUI to be initialized properly
// TODO(ebaum): this loop is ugly, will be replaced by some kind of one-shot condition
while
(
!
m_gui
->
isInitalized
()
)
{
}
m_gui
->
waitInitialized
().
wait
();
// default modules
m_moduleContainer
->
add
(
m_moduleFactory
->
create
(
m_moduleFactory
->
getPrototypeByName
(
"Navigation Slice Module"
)
)
,
true
);
...
...
src/modules/coordinateSystem/WMCoordinateSystem.cpp
View file @
69475ba5
...
...
@@ -142,7 +142,7 @@ void WMCoordinateSystem::updateGeometry()
boost
::
shared_lock
<
boost
::
shared_mutex
>
slock
;
slock
=
boost
::
shared_lock
<
boost
::
shared_mutex
>
(
m_updateLock
);
// *******************************************************************************************************
if
(
!
m_properties
->
getValue
<
bool
>
(
"textureChanged"
)
||
!
WKernel
::
getRunningKernel
()
->
getGui
()
->
isInitalized
()
)
if
(
!
m_properties
->
getValue
<
bool
>
(
"textureChanged"
)
||
!
WKernel
::
getRunningKernel
()
->
getGui
()
->
isInit
i
alized
()
)
{
return
;
}
...
...
src/modules/navSlices/WMNavSlices.cpp
View file @
69475ba5
...
...
@@ -294,7 +294,7 @@ void WMNavSlices::updateTextures()
boost
::
shared_lock
<
boost
::
shared_mutex
>
slock
;
slock
=
boost
::
shared_lock
<
boost
::
shared_mutex
>
(
m_updateLock
);
if
(
m_properties
->
getValue
<
bool
>
(
"textureChanged"
)
&&
WKernel
::
getRunningKernel
()
->
getGui
()
->
isInitalized
()
)
if
(
m_properties
->
getValue
<
bool
>
(
"textureChanged"
)
&&
WKernel
::
getRunningKernel
()
->
getGui
()
->
isInit
i
alized
()
)
{
m_properties
->
setValue
(
"textureChanged"
,
false
);
std
::
vector
<
boost
::
shared_ptr
<
WModule
>
>
datasetList
=
WKernel
::
getRunningKernel
()
->
getGui
()
->
getDataSetList
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment