# PostDeferredCallToThread

int PostDeferredCallToThread (DeferredCallbackPtr deferredFunction, void *callbackData, unsigned long targetThreadId);

## Purpose

Matches the capabilities of PostDeferredCall, except that you can specify the thread in which the callback is to be called. PostDeferredCall, on the other hand, always posts the call to the main thread.

The thread that you specify must call GetUserEvent, RunUserInterface, or ProcessSystemEvents to receive notification to call the deferred callback.

To obtain the ID of a thread, call the Utility Library function CmtGetCurrentThreadID.

## Parameters

Input
Name | Type | Description
deferredFunction | DeferredCallbackPtr | A pointer to the function whose execution is deferred until the specified thread calls GetUserEvent, RunUserInterface, or ProcessSystemEvents. This event function of type DeferredCallbackPtr takes the following form: void CVICALLBACK FunctionName (void *callbackData);
callbackData | void * | Points to data that you define. The callback function receives the pointer.
targetThreadId | unsigned long | The thread in which you want the deferred function to be called. To obtain the ID of a thread, call the Utility Library function CmtGetCurrentThreadID.

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
Code | Error Message String
xx | Success