CallbackMayRunLong

Indicates that the callback may not return quickly.

Syntax

BOOL CallbackMayRunLong(
         PTP_CALLBACK_INSTANCE pci
)  

Parameters

pci
Type: PTP_CALLBACK_INSTANCE 

[in, out] A TP_CALLBACK_INSTANCE structure that defines the callback instance. The structure is passed to the callback function.

Return value

Type: BOOL 

The function returns TRUE if another thread in the thread pool is available for processing callbacks or the thread pool was able to spin up a new thread. In this case, the current callback function may use the current thread indefinitely.The function returns FALSE if another thread in the thread pool is not available to process callbacks and the thread pool was not able to spin up a new thread. The thread pool will attempt to spin up a new thread after a delay, but if the current callback function runs long, the thread pool may lose efficiency.

Remarks

The thread pool may use this information to better determine when a new thread should be created.

The CallbackMayRunLong function should be called only by the thread that is processing the callback. Calling this function from another thread may cause a race condition.

The CallbackMayRunLong function always marks the callback as long-running, whether or not a thread is available for processing callbacks or the threadpool is able to allocate a new thread. Therefore, this function should be called only once, even if it returns FALSE.

Requirements

Header: Declared in threadpoolapiset.h.

Library: Use kernelx.lib.