Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
46e2d31a
Commit
46e2d31a
authored
Nov 10, 2009
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - threadMain now moduleMain
[ADD] - proper exception handly in module threads
parent
0a8b5fbe
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
64 additions
and
20 deletions
+64
-20
src/common/WException.cpp
src/common/WException.cpp
+11
-0
src/common/WException.h
src/common/WException.h
+7
-0
src/kernel/WModule.cpp
src/kernel/WModule.cpp
+21
-0
src/kernel/WModule.h
src/kernel/WModule.h
+6
-1
src/kernel/test/WModuleConnector_test.h
src/kernel/test/WModuleConnector_test.h
+1
-1
src/modules/coordinateSystem/WMCoordinateSystem.cpp
src/modules/coordinateSystem/WMCoordinateSystem.cpp
+1
-1
src/modules/coordinateSystem/WMCoordinateSystem.h
src/modules/coordinateSystem/WMCoordinateSystem.h
+1
-1
src/modules/data/WMData.cpp
src/modules/data/WMData.cpp
+1
-1
src/modules/data/WMData.h
src/modules/data/WMData.h
+1
-1
src/modules/eegTest/WMEEGTest.cpp
src/modules/eegTest/WMEEGTest.cpp
+1
-1
src/modules/eegTest/WMEEGTest.h
src/modules/eegTest/WMEEGTest.h
+1
-1
src/modules/fiberClustering/WMFiberClustering.cpp
src/modules/fiberClustering/WMFiberClustering.cpp
+1
-1
src/modules/fiberClustering/WMFiberClustering.h
src/modules/fiberClustering/WMFiberClustering.h
+1
-1
src/modules/fiberCulling/WMFiberCulling.cpp
src/modules/fiberCulling/WMFiberCulling.cpp
+1
-1
src/modules/fiberCulling/WMFiberCulling.h
src/modules/fiberCulling/WMFiberCulling.h
+1
-1
src/modules/fiberDisplay/WMFiberDisplay.cpp
src/modules/fiberDisplay/WMFiberDisplay.cpp
+1
-1
src/modules/fiberDisplay/WMFiberDisplay.h
src/modules/fiberDisplay/WMFiberDisplay.h
+1
-1
src/modules/marchingCubes/WMMarchingCubes.cpp
src/modules/marchingCubes/WMMarchingCubes.cpp
+1
-1
src/modules/marchingCubes/WMMarchingCubes.h
src/modules/marchingCubes/WMMarchingCubes.h
+1
-1
src/modules/navSlices/WMNavSlices.cpp
src/modules/navSlices/WMNavSlices.cpp
+1
-1
src/modules/navSlices/WMNavSlices.h
src/modules/navSlices/WMNavSlices.h
+1
-1
src/modules/test/WMTest.cpp
src/modules/test/WMTest.cpp
+1
-1
src/modules/test/WMTest.h
src/modules/test/WMTest.h
+1
-1
No files found.
src/common/WException.cpp
View file @
46e2d31a
...
...
@@ -56,6 +56,17 @@ WException::WException( const std::string& msg ): exception()
}
}
WException
::
WException
(
const
std
::
exception
&
e
)
:
exception
(
e
)
{
m_msg
=
e
.
what
();
// print stacktrace and message
// no backtrace?
if
(
!
noBacktrace
)
{
std
::
cerr
<<
"Exception thrown! Callstack's backtrace:"
<<
std
::
endl
<<
getBacktrace
()
<<
std
::
endl
;
}
}
WException
::~
WException
()
throw
()
{
...
...
src/common/WException.h
View file @
46e2d31a
...
...
@@ -48,6 +48,13 @@ public:
*/
explicit
WException
(
const
std
::
string
&
msg
=
std
::
string
()
);
/**
* Copy a std::exception and encapsulate it.
*
* \param e the exception.
*/
WException
(
const
std
::
exception
&
e
);
/**
* Destructor.
*/
...
...
src/kernel/WModule.cpp
View file @
46e2d31a
...
...
@@ -36,6 +36,7 @@
#include "exceptions/WModuleSignalSubscriptionFailed.h"
#include "exceptions/WModuleConnectorInitFailed.h"
#include "exceptions/WModuleUninitialized.h"
#include "../common/WException.h"
#include "WModule.h"
...
...
@@ -240,3 +241,23 @@ void WModule::connectToGui()
{
}
void
WModule
::
threadMain
()
{
try
{
// call main thread function
moduleMain
();
}
catch
(
WException
&
e
)
{
// ensure proper exception propagation
signal_error
(
shared_from_this
(),
e
);
}
catch
(
std
::
exception
&
e
)
{
// convert these exceptions to WException
WException
ce
=
WException
(
e
);
signal_error
(
shared_from_this
(),
ce
);
}
}
src/kernel/WModule.h
View file @
46e2d31a
...
...
@@ -165,7 +165,12 @@ protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
threadMain
()
=
0
;
virtual
void
moduleMain
()
=
0
;
/**
* Thread entry point. Calls moduleMain and sends error notification if needed.
*/
void
threadMain
();
/**
* Sets the container this module is associated with.
...
...
src/kernel/test/WModuleConnector_test.h
View file @
46e2d31a
...
...
@@ -108,7 +108,7 @@ protected:
std
::
string
n
;
// required since pure virtual
virtual
void
thread
Main
()
virtual
void
module
Main
()
{
// Since the modules run in a separate thread: such loops are possible
while
(
!
m_FinishRequested
)
...
...
src/modules/coordinateSystem/WMCoordinateSystem.cpp
View file @
46e2d31a
...
...
@@ -47,7 +47,7 @@ boost::shared_ptr< WModule > WMCoordinateSystem::factory() const
return
boost
::
shared_ptr
<
WMCoordinateSystem
>
(
new
WMCoordinateSystem
()
);
}
void
WMCoordinateSystem
::
thread
Main
()
void
WMCoordinateSystem
::
module
Main
()
{
createGeometry
();
...
...
src/modules/coordinateSystem/WMCoordinateSystem.h
View file @
46e2d31a
...
...
@@ -88,7 +88,7 @@ protected:
* \par Description
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
private:
/**
...
...
src/modules/data/WMData.cpp
View file @
46e2d31a
...
...
@@ -124,7 +124,7 @@ std::string getSuffix( std::string name )
return
p
.
extension
();
}
void
WMData
::
thread
Main
()
void
WMData
::
module
Main
()
{
std
::
string
fileName
=
m_properties
->
getValue
<
std
::
string
>
(
"filename"
);
...
...
src/modules/data/WMData.h
View file @
46e2d31a
...
...
@@ -90,7 +90,7 @@ protected:
* \par Description
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
/**
* Initialize connectors in this function. This function must not be called multiple times for one module instance.
...
...
src/modules/eegTest/WMEEGTest.cpp
View file @
46e2d31a
...
...
@@ -104,7 +104,7 @@ void drawChannel( boost::shared_ptr< const WEEG > eegData, size_t channelId, osg
sceneDataGeode
->
addDrawable
(
textOne
);
}
void
WMEEGTest
::
thread
Main
()
void
WMEEGTest
::
module
Main
()
{
// load the sample scene.
//osg::Geode* sceneDataGeode = new osg::Geode();
...
...
src/modules/eegTest/WMEEGTest.h
View file @
46e2d31a
...
...
@@ -72,7 +72,7 @@ protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
private:
};
...
...
src/modules/fiberClustering/WMFiberClustering.cpp
View file @
46e2d31a
...
...
@@ -62,7 +62,7 @@ boost::shared_ptr< WModule > WMFiberClustering::factory() const
return
boost
::
shared_ptr
<
WModule
>
(
new
WMFiberClustering
()
);
}
void
WMFiberClustering
::
thread
Main
()
void
WMFiberClustering
::
module
Main
()
{
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
;
// TODO(math): fix this hack when possible by using an input connector.
...
...
src/modules/fiberClustering/WMFiberClustering.h
View file @
46e2d31a
...
...
@@ -79,7 +79,7 @@ protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
private:
/**
...
...
src/modules/fiberCulling/WMFiberCulling.cpp
View file @
46e2d31a
...
...
@@ -58,7 +58,7 @@ boost::shared_ptr< WModule > WMFiberCulling::factory() const
return
boost
::
shared_ptr
<
WModule
>
(
new
WMFiberCulling
()
);
}
void
WMFiberCulling
::
thread
Main
()
void
WMFiberCulling
::
module
Main
()
{
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
;
// TODO(math): fix this hack when possible by using an input connector.
...
...
src/modules/fiberCulling/WMFiberCulling.h
View file @
46e2d31a
...
...
@@ -76,7 +76,7 @@ protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
/**
* Detect and removes fibers that have a short distance in terms of the
...
...
src/modules/fiberDisplay/WMFiberDisplay.cpp
View file @
46e2d31a
...
...
@@ -97,7 +97,7 @@ osg::ref_ptr< osg::Geode > WMFiberDisplay::genFiberGeode( const wmath::WFiber &f
return
geode
;
}
void
WMFiberDisplay
::
thread
Main
()
void
WMFiberDisplay
::
module
Main
()
{
boost
::
shared_ptr
<
WDataHandler
>
dataHandler
;
// TODO(math): fix this hack when possible by using an input connector.
...
...
src/modules/fiberDisplay/WMFiberDisplay.h
View file @
46e2d31a
...
...
@@ -73,7 +73,7 @@ protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
/**
* Generates an OSG geometry for the given fiber.
...
...
src/modules/marchingCubes/WMMarchingCubes.cpp
View file @
46e2d31a
...
...
@@ -83,7 +83,7 @@ const std::string WMMarchingCubes::getDescription() const
}
void
WMMarchingCubes
::
thread
Main
()
void
WMMarchingCubes
::
module
Main
()
{
// TODO(wiebel): MC fix this hack when possible by using an input connector.
while
(
!
WKernel
::
getRunningKernel
()
)
...
...
src/modules/marchingCubes/WMMarchingCubes.h
View file @
46e2d31a
...
...
@@ -122,7 +122,7 @@ protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
/**
* Initialize the connectors this module is using.
...
...
src/modules/navSlices/WMNavSlices.cpp
View file @
46e2d31a
...
...
@@ -124,7 +124,7 @@ void WMNavSlices::notifyDataChange( boost::shared_ptr<WModuleConnector> input,
// in this case input==m_input
}
void
WMNavSlices
::
thread
Main
()
void
WMNavSlices
::
module
Main
()
{
createGeometry
();
...
...
src/modules/navSlices/WMNavSlices.h
View file @
46e2d31a
...
...
@@ -103,7 +103,7 @@ protected:
* \par Description
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
/**
* Initialize the connectors this module is using.
...
...
src/modules/test/WMTest.cpp
View file @
46e2d31a
...
...
@@ -58,7 +58,7 @@ const std::string WMTest::getDescription() const
return
"This module is for testing and development"
;
}
void
WMTest
::
thread
Main
()
void
WMTest
::
module
Main
()
{
// load the sample scene.
osg
::
ref_ptr
<
osg
::
Geode
>
sceneDataGeode
=
new
osg
::
Geode
();
...
...
src/modules/test/WMTest.h
View file @
46e2d31a
...
...
@@ -72,7 +72,7 @@ protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual
void
thread
Main
();
virtual
void
module
Main
();
private:
};
...
...
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