ImageGear for C and C++ on Windows v20.5 - Updated
IG_thread_data_ID_associate
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Thread Functions > IG_thread_data_ID_associate

ImageGear allows you to have different groups of settings for providing mechanisms for associating a thread with a particular group.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_thread_data_ID_associate(
        DWORD dwNewId,
        AT_BOOL bLeaveThreadStorage
);

Arguments:

Name Type Description
dwNewId DWORD ID of a new Data storage.
bLeaveThreadStorage AT_BOOL If TRUE, old data storage is left in memory even if unused by any of the threads.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

MFC Threads

Example:

 
Copy Code
AT_ERRCOUNT nErrCount = 0;
nErrCount = IG_comm_comp_attach("ART");
. . .
AfxBeginThread( IGProcThread1, NULL );
AfxBeginThread( IGProcThread2 , NULL );
UINT IGProcThread1( LPVOID lpData )
{
        AT_ERRCOUNT nErrCnt;
        nErrCnt = IG_thread_data_ID_associate( 1, TRUE );
        nErrCnt = IG_load_file( "picture1.bmp", &hIGear);
        . . .
        return 0;
}
UINT IGProcThread2( LPVOID lpData )
{
        AT_ERRCOUNT nErrCnt;
        nErrCnt = IG_thread_data_ID_associate( 2, TRUE );
        nErrCnt = IG_load_file( "picture2.bmp", &hIGear);
        . . .
        return 0;
}:

Remarks:

By default, each thread uses the global copy. Such a mechanism allows you to have ImageGear settings ("groups" that are identified by specific IDs) that are customized for each thread. This API allows you to associate a thread with different ImageGear settings. Allocation of new settings will result in the use of that group's default values if it doesn't exist prior to the call. The old copy of the settings will be deleted unless it's (a) a global copy used by other threads, or (b) bLeaveThreadStorage is TRUE.

The global group of ART settings cannot be used in multi-threaded application. You have to use this function to associate a new local group of settings for each new thread.

The access to the same PDF document from multiple threads is not permitted because the multiple threads cannot share Adobe PDF Library data types. PDF doc created/opened in the main thread can be only used from the main thread.

Is this page helpful?
Yes No
Thanks for your feedback.