ImageGear for C and C++ on Linux v18.10 - Updated
IG_thread_image_unlock
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Thread Functions > IG_thread_image_unlock

This function unlocks the specified locked HIGEAR.

Declaration:

 
Copy Code
AT_ERRCOUNT EXPORT ACCUAPI IG_thread_image_unlock(
        HIGEAR hIGear,
        AT_MODE nLockMode
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear Image handle.
nLockMode AT_MODE The lock mode (IG_THREAD_LOCK_READ or IG_THREAD_LOCK_WRITE) indicator. Several threads can perform read lock concurrently, but only one thread is allowed to do write lock.

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.

Example:

 
Copy Code
hIGear = pDoc->hMainGear;
        nErrCnt = IG_thread_image_lock( pDoc->hMainGear, IG_THREAD_LOCK_WRITE ); 
        if (nErrCnt == 0)
                {
                // locked successfully
                IG_IP_rotate_multiple_90( hIGear, IG_ROTATE_90 );
                IG_thread_image_unlock( pDoc->hMainGear, IG_THREAD_LOCK_WRITE ); 
...
                }

Remarks:

Two APIs (IG_thread_image_lock() and IG_thread_image_unlock()) are required for those situations in which two or more threads-at least one of which is modifying or deleting an image-are simultaneously accessing the same HIGEAR. For example, one thread can save HIGEAR to a JPEG file (read access to a HIGEAR), while another is performing rotation in the asynchronous mode (write access to a HIGEAR). Thus the "saving" thread would be required to call lock/unlock with the read mode as a parameter, and the "rotation" thread would be required to call lock/unlock with the write mode as a parameter.