Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWRunnableSelf

Module:  Threads   Package:  Threading


RWRunnableSelf RWRunnableHandle

Local Index

Members

Header File

#include <rw/thread/RWRunnableSelf.h>

Description

The RWRunnableSelf class is a handle class for a runnable object.

A runnable object provides the basic mechanisms used to create, control, and monitor the threads of execution within your application. Runnables are used to define the task or activity to be performed by a thread.

Each runnable object is reference-counted; a runnable body instance keeps a count of the number of handles that currently reference it. A runnable object is deleted when the last handle that references the body is deleted.

The public interface for a runnable is provided by its handle classes. Many of the public functions in a handle simply forward control to a corresponding protected function in the body class. A runnable handle class instance may be empty. Any attempt to use an empty handle to access a runnable will produce an RWTHRInvalidPointer exception.

The RWRunnableSelf class provides an interface for the thread executing inside of a runnable. It defines the runnable member functions that may only be executed by the internal thread. Threads executing outside of a runnable should access the runnable using the RWRunnable handle class. The RWRunnableHandle class defines those functions that may be accessed from either inside or outside of a runnable.

To retrieve an RWRunnableSelf handle instance for the current runnable, use the rwRunnable() function. You may also convert an RWRunnable handle to an RWRunnableSelf handle by calling the member RWRunnable::getRunnableSelf(), but any attempt to violate the thread access restrictions imposed by the separate interfaces will generally result in an RWTHRIllegalAccess exception.

Public Constructors

RWRunnableSelf();
RWRunnableSelf(RWStaticCtor);
RWRunnableSelf(const RWRunnableSelf& second);

Public Destructor

~RWRunnableSelf();

Public Member Operator

RWRunnableSelf&
operator=(const RWRunnableSelf& second);

Public Member Functions

RWRunnable
getRWRunnable() const;
RWRunnableSelf
getNestedRunnable() const;
void
interrupt();
void
serviceCancellation();
bool
serviceInterrupt();
void
sleep(unsigned long milliseconds);
void
yield();

Protected Constructor

RWRunnableSelf(const RWRunnable& second);

See Also

RWRunnable, RWRunnableFunction, RWTRunnableIOUFunction, RWRunnableServer, RWServerPool, RWThread, RWThreadFunction, RWTThreadIOUFunction



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.