struct __pthread

Defined at line 69 of file ../../zircon/third_party/ulib/musl/src/internal/threads_impl.h

Public Members

 abi
zx_handle_t handle_
_Atomic(int) lifecycle_
struct __pthread ** prevp
 create_handles
size_t storage_stack_size
size_t storage_guard_size
size_t storage_thread_block_size
uintptr_t storage_thread_block_address
uintptr_t storage_machine_stack_address
uintptr_t storage_unsafe_stack_address
 storage_handles
struct tls_dtor * tls_dtors
void *[128] tsd
int tsd_used
int errno_value
uintptr_t scudo_tsd
uint64_t gwp_asan_tsd
void * sanitizer_hook
intptr_t join_value
locale_t locale
char * dlerror_buf
int dlerror_flag

Public Methods

zx_futex_t * LifecycleFutex ()

Defined at line 88 of file ../../zircon/third_party/ulib/musl/src/internal/threads_impl.h

std::optional<Lifecycle> JoinOrDetachLifecycle (Lifecycle new_lifecycle)

Claim the thread as JOINED or DETACHED. Returns std::nullopt on success,

which only happens if the previous state was JOINABLE. On failure, it

returns the actual previous state.

Defined at line 93 of file ../../zircon/third_party/ulib/musl/src/internal/threads_impl.h

zx::thread TakeHandle (Lifecycle expected_lifecycle)

Extract the thread handle. Synchronizes with readers by setting the state

to FREED and checks the given expected state for consistency.

Defined at line 104 of file ../../zircon/third_party/ulib/musl/src/internal/threads_impl.h

Enumerations

enum Lifecycle
Name Value
JOINABLE 0
DETACHED 1
JOINED 2
EXITING 3
DONE 4
FREED 5

A thread starts JOINABLE, or DETACHED via pthread_attr_setdetachstate.

* If someone calls ThreadJoin on it, it transitions to JOINED.

* If someone calls ThreadDetach on it, it transitions to DETACHED.

* When it begins exiting, the EXITING state is entered.

* When it is no longer using its memory and handle resources, it

transitions to DONE. If the thread was DETACHED prior to EXITING, this

transition MAY not happen.

No other transitions occur.

Defined at line 79 of file ../../zircon/third_party/ulib/musl/src/internal/threads_impl.h