Function _conUnlockC() Foundation

Finshs the read or write lock of a string container.

Syntax
XPPAPIRET _conUnlockC(ContainerHandle chs);
Parameters
ContainerHandle chs
Handle of a locked container of character string type.
Return

The function returns an error code (XPP_ERR_...) when the container chs is not locked for read or write access. If the return value is zero, the string container was successfully unlocked.

Description

For direct read and write access to a string container, the string data is locked within the memory, so the memory manager cannot move it. The lock also prevents other threads from accessing the string data - a thread which tries to read a string locked by another thread is blocked until the lock is removed. For these reasons it is essentially neccessary to remove each lock with _conRLockC() or _conWLockC() as soon as possible with _conUnlockC().

Examples
/* 
Write access to a string. 
*/ 
#include <xppcon.h> 

ContainerHandle  hString; 
XPPAPIRET        xr; 
CHAR            *pString; 
ULONG            lenString; 


/* ... assign value to hString */ 

xr = _conWLockC(hString, &pString, &lenString); 
if (xr != 0) 
{ 
/* Error: hString either contains no characters 
          or hString is alredy fixed */ 
} 
else 
{ 
/* Operations with the string ... */ 

xr = _conUnlockC(hString); 
if (xr != 0) 
{ 
   /* fatal error ! */ 
} 
} 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.