curl-library
Thread Safe CAllback
Date: Tue, 25 Nov 2003 13:39:46 +0800
Good Day!
I have been using the callback function which i got from the examples.
Since it is not thread safe, do you guys have some thread safe callback
function that i can use?
Thanks in advance!
/* Not thread safe */
size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void
*data)
{
register int realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
if (mem->memory)
{
memcpy(&(mem->memory[mem->size]), ptr, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
}
return realsize;
}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-25