Foxit PDF SDK

Public Attributes | List of all members
FX_THREADHANDLER Struct Reference

Thread handler for application extension. More...

## Public Attributes
FX_HTHREAD(* | CreateThread )(FX_LPVOID pUserData, FX_INT32 nPriority, size_t szStack, FX_CALLBACK_ThreadProc lpfThreadProc, FX_LPVOID param)
| Callback function to create a thread. More...
FX_BOOL(* | ExitThread )(FX_LPVOID pUserData)
| Callback function to exit from the current thread. More...
FX_HTHREAD(* | GetCurrentThread )(FX_LPVOID pUserData)
| Callback function to get handle of the current thread. More...
FX_INT32(* | GetThreadPriority )(FX_LPVOID pUserData, FX_HTHREAD hThread)
| Callback function to get thread priority. More...
FX_LPVOID | pUserData
| Pointer to user data.
void(* | SetThreadPriority )(FX_LPVOID pUserData, FX_HTHREAD hThread, FX_INT32 nPriority)
| Callback function to set thread priority. More...
FX_INT32(* | WaitForMultipleThreads )(FX_LPVOID pUserData, const FX_HTHREAD *pThreads, FX_INT32 nCount)
| Wait for termination of multiple threads. More...
FX_INT32(* | WaitForSingleThread )(FX_LPVOID pUserData, FX_HTHREAD hThread)
| Wait for termination of a single thread. More...
void(* | Yield )(FX_LPVOID pUserData)
| Callback function to change CPU time to another thread. More...

## Detailed Description

Thread handler for application extension.

Note
  This feature is disabled under single-thread mode or FPDFAPI_MT isn't defined.

## Member Data Documentation

## ◆ CreateThread

FX_HTHREAD(* FX_THREADHANDLER::CreateThread) (FX_LPVOID pUserData, FX_INT32 nPriority, size_t szStack, FX_CALLBACK_ThreadProc lpfThreadProc, FX_LPVOID param)

Callback function to create a thread.

Parameters

  [in] | pUserData | Pointer to user data.
  [in] | nPriority | Thread priority, set to 0 at default.
  [in] | szStack | Stack size for thread, set to 0 at default.
  [in] | lpfThreadProc | Function address for thread procedure.
  [in] | param | User parameters passed to thread procedure.

Returns
  Handle of thread, NULL if failure.

## ◆ ExitThread

FX_BOOL(* FX_THREADHANDLER::ExitThread) (FX_LPVOID pUserData)

Callback function to exit from the current thread.

Parameters

  [in] | pUserData | Pointer to user data.

Returns
  true means success, while false means failure.

## ◆ GetCurrentThread

FX_HTHREAD(* FX_THREADHANDLER::GetCurrentThread) (FX_LPVOID pUserData)

Callback function to get handle of the current thread.

Parameters

  [in] | pUserData | Pointer to user data.

Returns
  Thread handle. NULL means error occurs.

## ◆ GetThreadPriority

FX_INT32(* FX_THREADHANDLER::GetThreadPriority) (FX_LPVOID pUserData, FX_HTHREAD hThread)

Callback function to get thread priority.

Parameters

  [in] | pUserData | Pointer to user data.
  [in] | hThread | Thread handle specifies a thread to retrieve its priority.

Returns
  Thread priority code, refers to FX_THREADPRIORITY_XXX macros.

## ◆ SetThreadPriority

void(* FX_THREADHANDLER::SetThreadPriority) (FX_LPVOID pUserData, FX_HTHREAD hThread, FX_INT32 nPriority)

Callback function to set thread priority.

Parameters

  [in] | pUserData | Pointer to user data.
  [in] | hThread | Thread handle specifies a thread to set its priority.
  [in] | nPriority | Thread priority code.

Returns
  None.

## ◆ WaitForMultipleThreads

FX_INT32(* FX_THREADHANDLER::WaitForMultipleThreads) (FX_LPVOID pUserData, const FX_HTHREAD *pThreads, FX_INT32 nCount)

Wait for termination of multiple threads.

Parameters

  [in] | pUserData | Pointer to user data.
  [in] | pThreads | Pointer to array of thread handles.
  [in] | nCount | Number of threads in array.

Returns
  0 means all threads terminates successfully, other value means failure.

## ◆ WaitForSingleThread

FX_INT32(* FX_THREADHANDLER::WaitForSingleThread) (FX_LPVOID pUserData, FX_HTHREAD hThread)

Wait for termination of a single thread.

Parameters

  [in] | pUserData | Pointer to user data.
  [in] | hThread | Thread handle specifies a thread to wait.

Returns
  0 means thread terminates successfully, other value means failure.

## ◆ Yield

void(* FX_THREADHANDLER::Yield) (FX_LPVOID pUserData)

Callback function to change CPU time to another thread.

Parameters

  [in] | pUserData | Pointer to user data.

Returns
  None.

Note
  Call this function to alternate to another thread if caller wants to break the current thread running. Calling thread will be awoken in next thread polling.