mcGetDataPtr — Return a pointer to data in memory after a completed operation (C API)
#include <memcom.h> void* mcGetDataPtr(int handle);
mcGetDataPtr is used after a non-blocking
operation to a remote database has been completed. Such an operation
must have been initiated beforehand, for example with
mcDBgetSetPos. If the operation has completed,
mcGetDataPtr returns a pointer to memory
allocated by MemCom, which must be freed after use by means of
mcDBfree. Otherwise, a NULL pointer is
returned. This call allows to have non-blocking semantics for calls
like mcDBgetSet.
/* initiate a non-blocking operation to retrieve dataset "SET.1" */
mcSetBlocking(handle, 0);
mcDBgetSet(handle, "SET.1", 0);
/* returns NULL when non-blocking */
/* loop until MemCom operation has completed */
for (;;) {
/* proceed with MemCom operation step-wise and check if it has
completed */
if (mcTest(handle))
break;
/* do other stuff */
...
}
/* get the pointer to the retrieved data */
data = mcGetDataPtr(handle);