THREAD.H(3)
π NAME π
include/Zycore/API/Thread.h β it's a C header from the Zycore library, bestie. This is the Library Functions Manual page for it, and it's literally all about threads and Thread Local Storage. Threads, babe. Concurrency. Slay. β¨
πΈ SYNOPSIS πΈ
#include <Zycore/Defines.h>
#include <Zycore/Status.h>
π Functions
ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThread (ZyanThread *thread)
ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThreadId (ZyanThreadId
*thread_id)
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsAlloc (ZyanThreadTlsIndex *index,
ZyanThreadTlsCallback destructor)
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsFree (ZyanThreadTlsIndex index)
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsGetValue (ZyanThreadTlsIndex
index, void **data)
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsSetValue (ZyanThreadTlsIndex
index, void *data)
Six functions. All of them return a status code. That's the vibe. π
β¨ Function Documentation β¨
π¦ ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThread (ZyanThread * thread)
Hands you the handle of the current thread. Like, the thread you're literally standing in right now. Main character energy, no cap. π
Parameters
threadβ Receives the handle of the current thread.
Returns
- A zyan status code.
π§ ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThreadId (ZyanThreadId * thread_id)
Gives you the unique id of the current thread. Its little government name. πͺͺ
Parameters
thread_idβ Receives the unique id of the current thread.
Returns
- A zyan status code.
π₯ ZYCORE_EXPORT ZyanStatus ZyanThreadTlsAlloc (ZyanThreadTlsIndex * index, ZyanThreadTlsCallback destructor)
Allocates a brand new Thread Local Storage (TLS) slot. It's giving "your own personal locker, per thread". ποΈβ¨
Parameters
indexβ Receives the TLS slot index.destructorβ A pointer to a destructor callback which is invoked to finalize the data in the TLS slot orZYAN_NULL, if not needed.
The maximum available number of TLS slots is implementation specific and different on each platform:
- Windows
- A total amount of
128slots per process are guaranteed
- A total amount of
- POSIX
- A total amount of
128slots per process are guaranteed - Some systems guarantee larger amounts like e.g.
1024slots per process
- A total amount of
β οΈ Note that the invocation rules for the destructor callback are also implementation specific and different on each platform. Don't assume, bestie. Check your platform.
- Windows
- The callback is invoked when a thread exits
- The callback is invoked when the process exits
- The callback is invoked when the TLS slot is released
- POSIX
- The callback is invoked when a thread exits and the stored value is not null
- The callback is NOT invoked when the process exits
- The callback is NOT invoked when the TLS slot is released
Returns
- A zyan status code.
π ZYCORE_EXPORT ZyanStatus ZyanThreadTlsFree (ZyanThreadTlsIndex index)
Releases a Thread Local Storage (TLS) slot. Cleanup era. The slot said "and I took that personally" and left. πͺπ¨
Parameters
indexβ The TLS slot index.
Returns
- A zyan status code.
π ZYCORE_EXPORT ZyanStatus ZyanThreadTlsGetValue (ZyanThreadTlsIndex index, void ** data)
Returns the value sitting inside the given Thread Local Storage (TLS) slot for the calling thread. Yes, that thread specifically. It's giving "what did I put in there" and not "what did everyone else put in there". π«Ά
Parameters
indexβ The TLS slot index.dataβ Receives the value inside the given Thread Local Storage (TLS) slot for the calling thread.
Returns
- A zyan status code.
β ZYCORE_EXPORT ZyanStatus ZyanThreadTlsSetValue (ZyanThreadTlsIndex index, void * data)
Sets the value of the given Thread Local Storage (TLS) slot for the calling thread. Put your stuff in your own lil locker, not everybody else's. π
Parameters
indexβ The TLS slot index.dataβ The value to store inside the given Thread Local Storage (TLS) slot for the calling thread
Returns
- A zyan status code.
π Author π
Generated automatically by Doxygen for Zycore from the source code. (So if the prose is a little dry, blame the robot, not me. π)
okay that's the whole page bestie, we ate fr fr π
β¨ This was Zycore, Version 1.5.2.0, and the page is include/Zy...PI/Thread.h(3) β go forth and thread responsibly, mwah ππ
π¦ where this page comes from
- ubuntu resolute: libzycore-doc 1.5.2-1build1 Β· MIT
- ubuntu stonking: libzycore-doc 1.5.2-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms