Partager via


Supported Thread Pool and Synchronization Functions (Compact 2013)

3/26/2014

This section describes the thread pool and synchronization functions that are now available in Windows Embedded Compact 2013 and explains how these functions differ from the Windows desktop. For an introduction to system threading and processes, see Processes and Threads (Windows) on MSDN.

Global Differences in Implementation

There are several differences in the thread pool and synchronization functions between Compact 2013 and the Windows desktop. The following list describes the differences that apply to all supported functions.

  • _WIN32_WINNT definition. You do not need to define _WIN32_WINNT to compile applications that use any of the thread pool or synchronization functions.

  • Flags. Compact 2013 supports only the WT_EXECUTEDEFAULT and WT_EXECUTEONLYONCE flags; all other flags are ignored.

  • System requirements. The following table shows the system requirements for all the thread pool and synchronization functions in Compact 2013.

    Minimum supported operating system

    Windows Embedded Compact 2013

    Header

    WinBase.h

    Library

    Coredll.lib

    DLL

    Coredll.dll

Function Descriptions

This section describes the thread pool and synchronization functions supported in Compact 2013 and explains how each function differs from the desktop version.

Supported Thread Pool Functions

The following table describes the thread pool functions available in coredll.dll. For detailed information and code syntax for each thread pool function, see Process and Thread Functions (Windows) on MSDN.

Function

Description

Differences from the desktop version

CloseThreadpool

Closes the specified thread pool.

CloseThreadpoolTimer

Releases the specified timer object.

CloseThreadpoolCleanupGroupMembers is not supported in Compact 2013.

CloseThreadpoolWait

Releases the specified wait object.

CloseThreadpoolCleanupGroupMembers is not supported in Compact 2013.

CloseThreadpoolWork

Releases the specified work object.

CloseThreadpoolCleanupGroupMembers is not supported in Compact 2013.

CreateThreadpool

Allocates a new pool of threads to execute callbacks.

CreateThreadpoolTimer

Creates a new timer object.

CreateThreadpoolWait

Creates a new wait object.

CreateThreadpoolWork

Creates a new work object.

DestroyThreadpoolEnvironment

Deletes the specified callback environment. Call this function when the callback environment is no longer needed for creating new thread pool objects.

This function is not inlined.

FreeLibraryWhenCallbackReturns

Specifies the DLL that the thread pool will unload when the current callback completes.

InitializeThreadpoolEnvironment

Initializes a callback environment.

  • This function is not inlined.
  • Create a callback environment if you plan to call one of the following functions to modify the environment:
    • SetThreadpoolCallbackLibrary
    • SetThreadpoolCallbackPool
  • To use the default callback environment, set the optional callback environment parameter to NULL when calling one of the following functions:
    • CreateThreadpoolTimer
    • CreateThreadpoolWait
    • CreateThreadpoolWork
    • TrySubmitThreadpoolCallback

IsThreadpoolTimerSet

Determines whether the specified timer object is currently set.

LeaveCriticalSectionWhenCallbackReturns

Specifies the critical section that the thread pool will release when the current callback completes.

QueueUserWorkItem

Queues a work item to a worker thread in the thread pool.

ReleaseMutexWhenCallbackReturns

Specifies the mutex that the thread pool will release when the current callback completes.

ReleaseSemaphoreWhenCallbackReturns

Specifies the semaphore that the thread pool will release when the current callback completes.

SetEventWhenCallbackReturns

Specifies the event that the thread pool will set when the current callback completes.

SetThreadpoolCallbackLibrary

Ensures that the specified DLL remains loaded as long as there are outstanding callbacks.

This function is not inlined.

SetThreadpoolCallbackPool

Sets the thread pool to be used when generating callbacks.

This function is not inlined.

SetThreadpoolThreadMaximum

Sets the maximum number of threads that the specified thread pool can allocate to process callbacks.

SetThreadpoolThreadMinimum

Sets the minimum number of threads that the specified thread pool must make available to process callbacks.

SetThreadpoolTimer

Sets the timer object. A worker thread calls the timer object's callback after the specified timeout expires.

SetThreadpoolWait

Sets the wait object. A worker thread calls the wait object's callback function after the handle becomes signaled or after the specified timeout expires.

SubmitThreadpoolWork

Posts a work object to the thread pool. A worker thread calls the work object's callback function.

TimerCallback

The PTP_TIMER_CALLBACK type defines a pointer to this callback function. TimerCallback is a placeholder for the application-defined function name.

TrySubmitThreadpoolCallback

Requests that a thread pool worker thread call the specified callback function.

WaitForThreadpoolTimerCallbacks

Waits for outstanding timer callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.

WaitForThreadpoolWaitCallbacks

Waits for outstanding wait callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.

WaitForThreadpoolWorkCallbacks

Waits for outstanding work callbacks to complete and optionally cancels pending callbacks that have not yet started to execute.

Supported Synchronization Functions

The following table describes the synchronization functions available in coredll.dll. For detailed information and code syntax for each synchronization function, see Synchronization Functions (Windows) on MSDN.

Function

Description

ChangeTimerQueueTimer

Updates a timer-queue timer that was created by the ChangeTimerQueueTimer function.

CreateTimerQueue

Creates a queue for timers. Timer-queue timers are lightweight objects that enable you to specify a callback function to be called at a specified time.

CreateTimerQueueTimer

Creates a timer-queue timer. This timer expires at the specified due time, then after every specified period. When the timer expires, the callback function is called.

DeleteTimerQueueEx

Deletes a timer queue. Any pending timers in the queue are canceled and deleted.

DeleteTimerQueueTimer

Removes a timer from the timer queue and optionally waits for currently running timer callback functions to complete before deleting the timer.

RegisterWaitForSingleObject

Directs a wait thread in the thread pool to wait on the object.

UnregisterWaitEx

Cancels a registered wait operation issued by the RegisterWaitForSingleObject function.

See Also

Concepts

Application Development