ThreadedSource Class Reference

#include <yatephone.h>

Inheritance diagram for ThreadedSource:

DataSource DataNode RefObject GenObject List of all members.

Public Member Functions

virtual void destroyed ()
bool start (const char *name="ThreadedSource", Thread::Priority prio=Thread::Normal)
void stop ()
Threadthread () const
bool running () const
bool asyncDelete () const

Protected Member Functions

 ThreadedSource (const char *format="slin")
void asyncDelete (bool async)
void clearThread ()
virtual void run ()=0
virtual void cleanup ()
virtual bool zeroRefsTest ()

Friends

class ThreadedSourcePrivate

Detailed Description

A data source with a thread of its own


Constructor & Destructor Documentation

ThreadedSource ( const char *  format = "slin"  )  [inline, protected]

Threaded Source constructor

Parameters:
format Name of the data format, default "slin" (Signed Linear)


Member Function Documentation

virtual void destroyed (  )  [virtual]

The destruction notification, stops the thread

Reimplemented from DataSource.

bool start ( const char *  name = "ThreadedSource",
Thread::Priority  prio = Thread::Normal 
)

Starts the worker thread

Parameters:
name Static name of this thread
prio Thread's priority
Returns:
True if started, false if an error occured

void stop (  ) 

Stops and destroys the worker thread if running

Thread* thread (  )  const

Return a pointer to the worker thread

Returns:
Pointer to running worker thread or NULL

bool running (  )  const

Check if the data thread is running

Returns:
True if the data thread was started and is running

bool asyncDelete (  )  const [inline]

Get the current status of the asynchronous deletion flag

void asyncDelete ( bool  async  )  [inline, protected]

Derived classes should call this method to let the source to be destroyed asynchronously in the data thread

void clearThread (  )  [inline, protected]

Clear the worker thread pointer

virtual void run (  )  [protected, pure virtual]

The worker method. You have to reimplement it as you need

virtual void cleanup (  )  [protected, virtual]

The cleanup after thread method, deletes the source if already dereferenced and set for asynchronous deletion

virtual bool zeroRefsTest (  )  [protected, virtual]

Override so destruction can be delayed after all references were lost to let the data pumping thread end normally

Returns:
True to delete the source right away, false to defer

Reimplemented from RefObject.


The documentation for this class was generated from the following file:
Generated on Sun Aug 12 19:02:57 2007 for Yate by  doxygen 1.5.2