added signal possibility to threads
This commit is contained in:
parent
9adcedb8a4
commit
70a8e75020
3 changed files with 37 additions and 6 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Version : $Revision: 1.2 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/RunnableInterface.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -57,7 +57,7 @@ namespace Core {
|
|||
* A Runnable object, that can form the main execution body of a thread.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
* @version $Revision: 1.2 $
|
||||
* @see Thread
|
||||
*/
|
||||
class RunnableInterface
|
||||
|
@ -77,6 +77,14 @@ class RunnableInterface
|
|||
virtual void
|
||||
run(void) throw () = 0;
|
||||
|
||||
/**
|
||||
* Send a signal to the runnable object.
|
||||
*
|
||||
* @param userData user-specific parameter for the signal.
|
||||
*/
|
||||
virtual void
|
||||
signal(int userData) throw () = 0;
|
||||
|
||||
/**
|
||||
* Signal the thread to stop, gracefully.
|
||||
* This is just a call to signal the execution to stop, eventually.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.3 $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Thread.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -62,7 +62,7 @@ namespace Core {
|
|||
* A generic thread executor class.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.3 $
|
||||
* @version $Revision: 1.4 $
|
||||
* @see RunnableInterface
|
||||
*/
|
||||
class Thread
|
||||
|
@ -152,6 +152,18 @@ class Thread
|
|||
*/
|
||||
virtual void
|
||||
join(void) throw ();
|
||||
|
||||
/**
|
||||
* Send a signal to the runnable object inside this thread.
|
||||
*
|
||||
* @param userData user-specific parameter for the signal.
|
||||
*/
|
||||
virtual void
|
||||
signal(int userData) throw ()
|
||||
{
|
||||
runnable->signal(userData);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.2 $
|
||||
Version : $Revision: 1.3 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TestRunnable.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -59,7 +59,7 @@ namespace Core {
|
|||
* A sample Runnable object, for testing purposes.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.2 $
|
||||
* @version $Revision: 1.3 $
|
||||
*/
|
||||
class TestRunnable : public virtual RunnableInterface
|
||||
{
|
||||
|
@ -128,6 +128,17 @@ class TestRunnable : public virtual RunnableInterface
|
|||
shouldRun = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a signal to this object.
|
||||
* This currently simply does nothing.
|
||||
*
|
||||
* @param userData the user data for the signal.
|
||||
*/
|
||||
virtual void
|
||||
signal(int userData) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of the object.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue