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

#include <Thread.hh>

Public Member Functions

 Thread (const Thread &)=delete
 
Threadoperator= (const Thread &)=delete
 
 Thread (Runnable *runnable)
 Create a new thread. More...
 
 ~Thread ()
 
void start ()
 Start 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 17 of file Thread.hh.

Constructor & Destructor Documentation

§ Thread() [1/2]

openmsx::Thread::Thread ( const Thread )
delete

§ Thread() [2/2]

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 25 of file Thread.cc.

§ ~Thread()

openmsx::Thread::~Thread ( )

Definition at line 30 of file Thread.cc.

Member Function Documentation

§ isMainThread()

bool openmsx::Thread::isMainThread ( )
static

§ join()

void openmsx::Thread::join ( )

Waits for this thread to terminate.

This method must be called on a started thread before it can be destructed.

Definition at line 49 of file Thread.cc.

References openmsx::MSXException::getMessage(), openmsx::FatalError::getMessage(), and openmsx::Runnable::run().

Referenced by openmsx::StdioConnection::output(), openmsx::MidiInReader::unplugHelper(), openmsx::RS232Tester::unplugHelper(), and openmsx::PreCacheFile::~PreCacheFile().

§ operator=()

Thread& openmsx::Thread::operator= ( const Thread )
delete

§ setMainThread()

void openmsx::Thread::setMainThread ( )
static

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

Definition at line 12 of file Thread.cc.

§ start()

void openmsx::Thread::start ( )

Start this thread.

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

Definition at line 38 of file Thread.cc.

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


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