1 #ifndef LIBSLAMFLEX_JNI_THREAD_H_
2 #define LIBSLAMFLEX_JNI_THREAD_H_
48 static unsigned int count();
54 static void sleep(
unsigned int milli);
Thread()
Construct a thread. If runnable != 0, use that runnable, else use our own "run" method.
virtual void run()
Override this method to do whatever it is the thread should do.
static void yield()
Tell the current thread to yield the processor.
void stop()
Tell the thread to stop.
static unsigned int count()
Returns how many threads are actually running, not including the main thread.
This is an abstract base class for anything with a run() method.
void start(Runnable *runnable=0)
Start execution of "run" method in separate thread.
static Thread * getCurrent()
Returns a pointer to the currently running thread.
static void * threadproc(void *param)
bool isRunning() const
Returns true if the thread is still running.
static bool ourInitializedFlag
static pthread_key_t ourKey
pthread_t getID()
Get the ID of this thread.
bool shouldStop() const
Returns true if the stop() method been called, false otherwise.
static unsigned int ourCount
virtual ~Thread()
This does not destroy the object until the thread has been terminated.
void join()
This blocks until the thread has actually terminated.
static void sleep(unsigned int milli)
Tell the current thread to sleep for milli milliseconds.