Commit 77ffc7d7 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - added some comments

[ADD] - added msleep method to wait microseconds
parent e75ddc8a
......@@ -119,10 +119,19 @@ void WThreadedRunner::yield() const
#endif
}
void WThreadedRunner::sleep( const int t ) const
void WThreadedRunner::sleep( const int32_t t ) const
{
#if USE_BOOST_THREADS
boost::this_thread::sleep( boost::posix_time::seconds( t ) );
#else
m_Thread->microSleep( 1000000 * t );
#endif
}
void WThreadedRunner::msleep( const int32_t t ) const
{
#if USE_BOOST_THREADS
boost::this_thread::sleep( boost::posix_time::microseconds( t ) );
#else
m_Thread->microSleep( t );
#endif
......
......@@ -25,6 +25,8 @@
#ifndef WTHREADEDRUNNER_H
#define WTHREADEDRUNNER_H
#include <stdint.h>
#ifdef _WIN32
#define USE_BOOST_THREADS 0
#else
......@@ -127,7 +129,14 @@ protected:
*
* \param t time to sleep in seconds.
*/
void sleep( const int t ) const;
void sleep( const int32_t t ) const;
/**
* Sets thread asleep.
*
* \param t time to sleep in microseconds.
*/
void msleep( const int32_t t ) const;
/**
* Let the thread sleep until a stop request was given.
......
......@@ -41,6 +41,7 @@
#include "../dataHandler/WDataHandler.h"
#include "../common/WPreferences.h"
#include "../common/WStringUtils.h"
#include "../common/WThreadedRunner.h"
#include "WModule.h"
#include "WBatchLoader.h"
#include "WModuleFactory.h"
......
......@@ -34,7 +34,6 @@
#include "../common/WFlag.h"
#include "../common/WLogger.h"
#include "../common/WThreadedRunner.h"
#include "../graphicsEngine/WGraphicsEngine.h"
#include "../gui/WGUI.h"
#include "../modules/fiberDisplay/WROIManagerFibers.h"
......@@ -42,6 +41,8 @@
#include "WModuleContainer.h"
#include "WModuleFactory.h"
class WThreadedRunner;
/**
* \defgroup kernel Kernel
*
......@@ -116,7 +117,8 @@ public:
void loadDataSetsSynchronously( std::vector< std::string > fileNames );
/**
* Function combines to modules. This is a simple alias for "getRootContainer()->applyModule".
* Function combines to modules. This is a simple alias for "getRootContainer()->applyModule". It runs synchronously, which
* could freeze the calling thread for a couple of time.
*
* \param applyOn the module which already has to be in the container and to apply the other one on.
* \param prototype the prototype of the module to apply on the other one specified.
......
......@@ -279,7 +279,8 @@ boost::shared_ptr< WModule > WModuleContainer::applyModule( boost::shared_ptr< W
return applyModule( applyOn, WModuleFactory::getModuleFactory()->getPrototypeByName( what ) );
}
boost::shared_ptr< WModule > WModuleContainer::applyModule( boost::shared_ptr< WModule > applyOn, boost::shared_ptr< WModule > prototype )
boost::shared_ptr< WModule > WModuleContainer::applyModule( boost::shared_ptr< WModule > applyOn,
boost::shared_ptr< WModule > prototype )
{
// is this module already associated with another container?
if ( applyOn->isAssociated()() && ( applyOn->getAssociatedContainer() != shared_from_this() ) )
......
......@@ -118,7 +118,8 @@ public:
virtual void addDefaultNotifier( MODULE_SIGNAL signal, t_ModuleGenericSignalHandlerType notifier );
/**
* Function combines to modules.
* Function combines two modules. This runs synchronously. It might take some time to finish since combination of modules is
* allowed only with modules marked as "ready" which might take some time.
*
* \param applyOn the module which already has to be in the container and to apply the other one on.
* \param what the prototype name of the module to apply on the other one specified.
......@@ -128,7 +129,8 @@ public:
virtual boost::shared_ptr< WModule > applyModule( boost::shared_ptr< WModule > applyOn, std::string what );
/**
* Function combines to modules.
* Function combines two modules. This runs synchronously. It might take some time to finish since combination of modules is
* allowed only with modules marked as "ready" which might take some time.
*
* \param applyOn the module which already has to be in the container and to apply the other one on.
* \param prototype the prototype of the module to apply on the other one specified.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment