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 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 17 of file Thread.hh.

Constructor & Destructor Documentation

openmsx::Thread::Thread ( const Thread )
openmsx::Thread::Thread ( Runnable runnable)

Create a new thread.

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

Definition at line 26 of file

openmsx::Thread::~Thread ( )

Definition at line 32 of file

References stop().

Member Function Documentation

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

Waits for this thread to terminate.

Definition at line 59 of file

Referenced by openmsx::CliServer::~CliServer(), and openmsx::PreCacheFile::~PreCacheFile().

Thread& openmsx::Thread::operator= ( const Thread )
void openmsx::Thread::setMainThread ( )

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

Definition at line 13 of file

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

Referenced by openmsx::CliServer::CliServer(), 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

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

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