Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
 SetThreadpoolCallbackLibrary Functi...

  Switch on low bandwidth view
SetThreadpoolCallbackLibrary Function

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

Syntax

C++
VOID SetThreadpoolCallbackLibrary(
  __inout  PTP_CALLBACK_ENVIRON pcbe,
  __in     PVOID mod
);

Parameters

pcbe [in, out]

A TP_CALLBACK_ENVIRON structure that defines the callback environment. The InitializeThreadpoolEnvironment function returns this structure.

mod [in]

A handle to the DLL.

Return Value

This function does not return a value.

Remarks

You should call this function if a callback might acquire the loader lock. This prevents a deadlock from occurring when one thread in DllMain is waiting for the callback to end, and another thread that is executing the callback attempts to acquire the loader lock.

If the DLL containing the callback might be unloaded, the cleanup code in DllMain must cancel outstanding callbacks before releasing the object.

This function is somewhat expensive. You should consider other options for ensuring that the library is not unloaded while callbacks are executing, or to guarantee that callbacks which may be executing do not acquire the loader lock.

This function is implemented as an inline function.

To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or higher.

Requirements

Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
HeaderWinbase.h (include Windows.h)

See Also

DestroyThreadpoolEnvironment
FreeLibraryWhenCallbackReturns
InitializeThreadpoolEnvironment
SetThreadpoolCallbackCleanupGroup
SetThreadpoolCallbackPool
SetThreadpoolCallbackRunsLong
Thread Pools

Send comments about this topic to Microsoft

Build date: 7/2/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker