Admin Production ni-theme
Current Publication

PostDeferredCallToThread

LabWindows/CVI

PostDeferredCallToThread

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

Purpose

Matches the capabilities of PostDeferredCall, except that you can specify the thread in which to call the callback. 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.

Note Note  To obtain the ID of the 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 int The thread in which you want the deferred function to be called.

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

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later

Examples

Refer to the following examples that use the PostDeferredCallToThread function:

  • apps\daqmthread\daqMT.cws

    Open example
  • utility\threading\ThreadPool\MultiPanel\MultiPanel.cws

    Open example