typedef test_pal_thread_state_t

From liblfds.org
Jump to navigation Jump to search

Source File



typedef [type] test_pal_thread_state_t;


This typedef is mandatory.


Threads typically have associated with them both an ID and a handle.

This typedef is for the handle - i.e. the datum which the OS can wait on for thread termination.

If we look at the Windows CreateThread function;

HANDLE WINAPI CreateThread( _In_opt_  LPSECURITY_ATTRIBUTES  lpThreadAttributes,
                            _In_      SIZE_T                 dwStackSize,
                            _In_      LPTHREAD_START_ROUTINE lpStartAddress,
                            _In_opt_  LPVOID                 lpParameter,
                            _In_      DWORD                  dwCreationFlags,
                            _Out_opt_ LPDWORD                lpThreadId );

We see there is an argument, lpThreadId , which receives the thread ID, but that the function returns a HANDLE, which is the datum used by WaitForSingleObject to sleep until the thread has terminated.


typedef HANDLE test_pal_thread_state_t;

See Also