THREAD.H(3)

πŸ“¦
version 1.5.2 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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 or ZYAN_NULL, if not needed.

The maximum available number of TLS slots is implementation specific and different on each platform:

  • Windows
    • A total amount of 128 slots per process are guaranteed
  • POSIX
    • A total amount of 128 slots per process are guaranteed
    • Some systems guarantee larger amounts like e.g. 1024 slots per process
⚠️ 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