18#ifndef _DECAF_INTERNAL_UTIL_CONCURRENT_THREADING_H_
19#define _DECAF_INTERNAL_UTIL_CONCURRENT_THREADING_H_
30 using decaf::lang::Thread;
40 Threading(
const Threading&);
41 Threading& operator= (
const Threading&);
202 long long stackSize);
237 static bool sleep(
long long mills,
int nanos);
304 static bool park(
Thread* thread,
long long mills,
int nanos);
342 static void detachFromCurrentThread(
ThreadHandle* thread);
State
Represents the various states that the Thread can be in during its lifetime.
Definition Thread.h:84
Definition ThreadLocalImpl.h:28
static void lockThreadsLib()
Locks the Threading library allowing an object to perform some operations safely in a multi-threaded ...
static ThreadHandle * createNewThread(Thread *parant, const char *name, long long stackSize)
Creates a new thread instance with the given Thread object as its parent, assigning it the given name...
static bool waitOnMonitor(MonitorHandle *monitor, long long mills, int nanos)
Waits on a monitor to be signaled by another thread.
static void setThreadLocalValue(int slot, void *value)
static const char * getThreadName(ThreadHandle *thread)
static bool isMonitorLocked(MonitorHandle *monitor)
Query the monitor object to determine if it is currently locked.
static ThreadHandle * createThreadWrapper(decaf::lang::Thread *parent, const char *name)
Creates and returns a ThreadHandle that references the currently running thread.
static void * getThreadLocalValue(int slot)
static MonitorHandle * takeMonitor(bool alreadyLocked=false)
Gets a monitor for use as a locking mechanism.
static void releaseCurrentThreadHandle()
static void initialize()
Called by the Decaf Runtime at startup to allow the Platform Threading code to initialize any necessa...
static void dumpRunningThreads()
Diagnostic method dumps all threads info to console.
static long long getThreadId(ThreadHandle *thread)
static void setThreadName(ThreadHandle *thread, const char *name)
static ThreadHandle * getCurrentThreadHandle()
static void notifyAllWaiters(MonitorHandle *monitor)
Notifies all waiting threads for the given Monitor.
static void unpark(Thread *thread)
If the target thread is not currently parked then this method sets the un-park token for the thread a...
static void enterMonitor(MonitorHandle *monitor)
Monitor locking method.
static bool tryEnterMonitor(MonitorHandle *monitor)
Monitor locking method.
static void start(ThreadHandle *thread)
Starts the given thread running, if the thread is already running then this method has no effect.
static bool isInterrupted(ThreadHandle *thread, bool reset)
static void destroyThread(ThreadHandle *thread)
static void park(Thread *thread)
Removes the given thread from scheduling unless a call to unpark has already reset the park token in ...
static void shutdown()
Called by the Decaf Runtime at Shutdown to allow the Platform Threading code to return any resources ...
static bool join(ThreadHandle *thread, long long mills, int nanos)
Joins the given thread instance and waits for it to either terminate or for the given timeout period ...
static void interrupt(ThreadHandle *thread)
static void unlockThreadsLib()
Unlocks the Threading library when locked.
static bool interrupted()
static bool sleep(long long mills, int nanos)
static int getThreadPriority(ThreadHandle *thread)
static Thread * getCurrentThread()
static int createThreadLocalSlot(ThreadLocalImpl *threadLocal)
Allocates a slot in the library for a new ThreadLocalImpl to store its values for each thread.
static void destoryThreadLocalSlot(int slot)
static bool park(Thread *thread, long long mills, int nanos)
Removes the given thread from scheduling unless a call to unpark has already reset the park token in ...
static void exitMonitor(MonitorHandle *monitor)
Exit the acquired monitor giving up the lock that is held and allowing other threads to acquire the m...
static void setThreadPriority(ThreadHandle *thread, int priority)
static Thread::State getThreadState(ThreadHandle *thread)
static void returnMonitor(MonitorHandle *monitor, bool alreadyLocked=false)
Returns a given monitor to the Monitor pool after the Monitor is no longer needed.
static bool isThreadAlive(ThreadHandle *thread)
static void notifyWaiter(MonitorHandle *monitor)
Notify a single waiter on the given Monitor instance, if there is no thread currently waiting on the ...
A Thread is a concurrent unit of execution.
Definition Thread.h:64
#define DECAF_API
Definition Config.h:29
Definition ByteArrayAdapter.h:30
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25
Definition ThreadingTypes.h:95
Definition ThreadingTypes.h:62