openMSX
Public Member Functions | Static Public Member Functions | List of all members
openmsx::Thread Class Reference

#include <Thread.hh>

Inheritance diagram for openmsx::Thread:
Inheritance graph
[legend]
Collaboration diagram for openmsx::Thread:
Collaboration graph
[legend]

Public Member Functions

 Thread (Runnable *runnable)
 Create a new thread. More...
 
 ~Thread ()
 
void start ()
 Start this thread. More...
 
void stop ()
 Destroys this thread. More...
 
void join ()
 Waits for this thread to terminate. More...
 

Static Public Member Functions

static void setMainThread ()
 Store ID of the main thread, should be called exactly once from the main thread. More...
 
static bool isMainThread ()
 Returns true when called from the main thread. More...
 

Detailed Description

Definition at line 19 of file Thread.hh.

Constructor & Destructor Documentation

openmsx::Thread::Thread ( Runnable runnable)
explicit

Create a new thread.

Parameters
runnableObject those run() method will be invoked by the created thread when it starts running.

Definition at line 26 of file Thread.cc.

openmsx::Thread::~Thread ( )

Definition at line 32 of file Thread.cc.

References stop().

Member Function Documentation

bool openmsx::Thread::isMainThread ( )
static
void openmsx::Thread::join ( )

Waits for this thread to terminate.

Definition at line 59 of file Thread.cc.

Referenced by openmsx::PreCacheFile::~PreCacheFile().

void openmsx::Thread::setMainThread ( )
static

Store ID of the main thread, should be called exactly once from the main thread.

Definition at line 13 of file Thread.cc.

void openmsx::Thread::start ( )

Start this thread.

It is not allowed to call this method on a running thread.

Definition at line 37 of file Thread.cc.

Referenced by openmsx::MidiInReader::plugHelper(), openmsx::RS232Tester::plugHelper(), and openmsx::PreCacheFile::PreCacheFile().

void openmsx::Thread::stop ( )

Destroys this thread.

Only use this method as a last resort, because it kills the thread with no regard for locks or resources the thread may be holding, I/O it is performing etc. If this method is called on a stopped thread, nothing happens.

Definition at line 47 of file Thread.cc.

Referenced by openmsx::MidiInReader::unplugHelper(), openmsx::RS232Tester::unplugHelper(), and ~Thread().


The documentation for this class was generated from the following files: