17#ifndef _DECAF_LANG_THREAD_H_
18#define _DECAF_LANG_THREAD_H_
38 class ThreadProperties;
70 ThreadProperties* properties;
75 static const int MIN_PRIORITY = 1;
78 static const int NORM_PRIORITY = 5;
81 static const int MAX_PRIORITY = 10;
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);
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
A Thread is a concurrent unit of execution.
Definition: Thread.h:64
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,...
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
Thread(const std::string &name)
Constructs a new Thread with the given name.
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 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.
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
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition: AprPool.h:25
Definition: ThreadingTypes.h:62