dplug.core.thread

Threads and thread-pool.

Members

Aliases

ThreadDelegate
alias ThreadDelegate = void delegate() nothrow @(nogc)

Legacy thread function

ThreadDelegateUser
alias ThreadDelegateUser = void delegate(void* userData) nothrow @(nogc)

Thread function with user data, used eg. in thread pool.

ThreadPoolDelegate
alias ThreadPoolDelegate = void delegate(int workItem, int threadIndex) nothrow @(nogc)
Undocumented in source.
btex_fptr
alias btex_fptr = uint function(void*)
Undocumented in source but is binding to Windows. You might be able to learn more by searching the web for its name.

Classes

ThreadPool
class ThreadPool

Fake synchronous version of the thread pool For measurement purpose, makes it easier to measure actual CPU time spent.

ThreadPool
class ThreadPool

Rewrite of the ThreadPool using condition variables. FUTURE: this could be speed-up by using futures. Description of the task and associated condition+mutex would go in an external struct. Note: the interface of the thread-pool itself is not thread-safe, you cannot give orders from multiple threads at once.

Functions

_beginthreadex
uintptr_t _beginthreadex(void* , uint , btex_fptr , void* , uint , uint* )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
getMacOSVersion
MacOSVersion getMacOSVersion()

Get the macOS version we are running on. Note: it only makes sense for macOS, not iOS. Note: patch always return zero for now.

getTotalNumberOfCPUs
int getTotalNumberOfCPUs()
launchInAThread
Thread launchInAThread(ThreadDelegate dg, size_t stackSize)

Launch a function in a newly created thread, which is destroyed afterwards. Return the thread so that you can call .join() on it.

makeThread
Thread makeThread(ThreadDelegate callback, size_t stackSize)
Undocumented in source. Be warned that the author may not have intended to support it.
makeThread
Thread makeThread(ThreadDelegateUser callback, size_t stackSize, void* userData)
Undocumented in source. Be warned that the author may not have intended to support it.
posixThreadEntryPoint
void* posixThreadEntryPoint(void* threadContext)
Undocumented in source. Be warned that the author may not have intended to support it.
sysctlbyname
int sysctlbyname(const(char)* , void* , size_t* , void* , size_t )
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
windowsThreadEntryPoint
uint windowsThreadEntryPoint(void* threadContext)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

getCurrentThreadId
size_t getCurrentThreadId()

Get the current thread OS handle. The returned ID is just used for display. You can't get a Thread out of it.

Structs

MacOSVersion
struct MacOSVersion
Undocumented in source.
Thread
struct Thread

Optimistic thread, failure not supported

Meta

License

Distributed under the Boost Software License 1.0. (See accompanying file LICENSE)

Authors

Sean Kelly, Walter Bright, Alex Rønne Petersen, Martin Nowak, David Simcha, Guillaume Piolat