17#ifndef _DECAF_LANG_THREAD_H_
18#define _DECAF_LANG_THREAD_H_
38 class ThreadProperties;
70 ThreadProperties* properties;
135 Thread(
const Thread&);
136 Thread& operator=(
const Thread&);
233 virtual void join(
long long millisecs);
247 virtual void join(
long long millisecs,
int nanos);
364 static void sleep(
long long millisecs);
381 static void sleep(
long long millisecs,
int nanos);
429 void initializeSelf(
Runnable* task,
const std::string& name,
long long stackSize);
Interface for handlers invoked when a Thread abruptly terminates due to an uncaught exception.
Definition Thread.h:118
Definition Threading.h:36
Interface for a runnable object - defines a task that can be run by a thread.
Definition Runnable.h:29
Interface for handlers invoked when a Thread abruptly terminates due to an uncaught exception.
Definition Thread.h:118
virtual ~UncaughtExceptionHandler()
Definition Thread.h:121
virtual void uncaughtException(const Thread *thread, const Throwable &error)=0
Method invoked when the given thread terminates due to the given uncaught exception.
Definition ThreadGroup.h:30
virtual void join(long long millisecs, int nanos)
Forces the Current Thread to wait until the thread exits.
void setPriority(int value)
Sets the current Thread's priority to the newly specified value.
std::string getName() const
Returns the Thread's assigned name.
Thread(Runnable *task, const std::string &name)
Constructs a new Thread with the given target Runnable task and name.
virtual void run()
Default implementation of the run method - does nothing.
Thread::State getState() const
Returns the currently set State of this Thread.
std::string toString() const
Returns a string that describes the Thread.
void interrupt()
Interrupts the Thread if it is blocked and in an interruptible state.
static UncaughtExceptionHandler * getDefaultUncaughtExceptionHandler()
Set the default handler invoked when a thread abruptly terminates due to an uncaught exception,...
static const int MAX_PRIORITY
The maximum priority that a thread can have.
Definition Thread.h:81
Thread()
Constructs a new Thread.
Thread(Runnable *task, const std::string &name, long long stackSize)
Constructs a new Thread with the given target Runnable task and name.
State
Represents the various states that the Thread can be in during its lifetime.
Definition Thread.h:84
@ NEW
Before a Thread is started it exists in this State.
Definition Thread.h:87
@ RUNNABLE
While a Thread is running and is not blocked it is in this State.
Definition Thread.h:90
@ TERMINATED
A Thread whose run method has exited is in this state.
Definition Thread.h:108
@ WAITING
A Thread that is waiting for another Thread to perform an action is in this state.
Definition Thread.h:96
@ SLEEPING
A Thread that is blocked in a Sleep call is in this state.
Definition Thread.h:105
@ BLOCKED
A Thread that is waiting to acquire a lock is in this state.
Definition Thread.h:93
@ TIMED_WAITING
A Thread that is waiting for another Thread to perform an action up to a specified time interval is i...
Definition Thread.h:102
Thread(const std::string &name)
Constructs a new Thread with the given name.
static const int MIN_PRIORITY
The minimum priority that a thread can have.
Definition Thread.h:75
virtual void join()
Forces the Current Thread to wait until the thread exits.
bool isAlive() const
Returns true if the Thread is alive, meaning it has been started and has not yet died.
void setName(const std::string &name)
Sets the name of the Thread to the new Name given by the argument name
void setUncaughtExceptionHandler(UncaughtExceptionHandler *handler)
Set the handler invoked when this thread abruptly terminates due to an uncaught exception.
int getPriority() const
Gets the currently set priority for this Thread.
static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler *handler)
Set the default handler invoked when a thread abruptly terminates due to an uncaught exception,...
long long getId() const
Obtains the Thread Id of the current thread, this value is OS specific but is guaranteed not to chang...
static bool interrupted()
Returns whether the thread has been interrupted and clears the interrupted state such that a subseque...
UncaughtExceptionHandler * getUncaughtExceptionHandler() const
Set the handler invoked when this thread abruptly terminates due to an uncaught exception.
static const int NORM_PRIORITY
The default priority that a thread is given at create time.
Definition Thread.h:78
static void sleep(long long millisecs, int nanos)
Causes the currently executing thread to halt execution for the specified number of milliseconds plus...
virtual void start()
Creates a system thread and starts it in a joinable mode.
static void yield()
Causes the currently executing thread object to temporarily pause and allow other threads to execute.
static Thread * currentThread()
Returns a pointer to the currently executing thread object.
Thread(Runnable *task)
Constructs a new Thread with the given target Runnable task.
bool isInterrupted() const
Returns but does not clear the state of this Thread's interrupted flag.
friend class ThreadGroup
Definition Thread.h:442
static void sleep(long long millisecs)
Causes the currently executing thread to halt execution for the specified number of milliseconds,...
virtual void join(long long millisecs)
Forces the Current Thread to wait until the thread exits.
This class represents an error that has occurred.
Definition Throwable.h:44
#define DECAF_API
Definition Config.h:29
Definition ByteArrayAdapter.h:30
Definition ThreadingTypes.h:31
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25
Definition ThreadingTypes.h:62