Page Speed Optimization Libraries  1.4.26.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
net_instaweb::ThreadSystem::Thread Class Reference

Base class for client thread code. More...

#include "thread.h"

Inheritance diagram for net_instaweb::ThreadSystem::Thread:
net_instaweb::SchedulerThread

List of all members.

Public Member Functions

 Thread (ThreadSystem *runtime, StringPiece name, ThreadFlags flags)
virtual ~Thread ()
bool Start ()
 Invokes Run() in a separate thread. Returns if successful or not.
void Join ()
GoogleString name () const
virtual void Run ()=0

Detailed Description

Base class for client thread code.


Constructor & Destructor Documentation

net_instaweb::ThreadSystem::Thread::Thread ( ThreadSystem runtime,
StringPiece  name,
ThreadFlags  flags 
)

Initializes the thread object for given runtime, but does not start it. (You need to call Start() for that)

If you pass in kJoinable for flags, you must explicitly call Join() to wait for thread to complete and release associated resources. That is not needed with kDetach, but you are still responsible for cleaning up the Thread object.

Any mutexes and condvars you use must be compatible with the passed in 'runtime'.

The 'name' will be used purely for debugging purposes. Note that on many systems (e.g. Linux PThreads) the OS will only keep track of 15 characters, so you may not want to get too wordy.

Note: it is safe to delete the Thread object from within ::Run as far as this baseclass is concerned.


Member Function Documentation

Waits for the thread executing Run() to exit. This must be called on every thread created with kJoinable.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines