[xml] Second call to xmlReaderForMemory breaks in separated thread



Hi all,

The following code breaks in a Windows environment (I didn't have a chance to test it in a Linux machine so 
far) when xmlReaderForMemory is called in function processCommands in a separated thread. It won't break if 
called in the main thread, or if the first call to xmlReaderForMemory in main is commented out.

And the error message I'm getting is "Unhandled exception at 0x77a9fc47 in XmlDebug.exe: 0xC0000005: Access 
violation writing location 0x00000014."

Does anyone know what I'm doing wrong, or where I could find more information about it?

Thanks in advance,

Andre


#include <Windows.h>
#include <boost/thread.hpp>

#include "libxml/xmlreader.h"

void processCommands()
{
   xmlTextReaderPtr reader = xmlReaderForMemory("          ", 10, "noname.xml", NULL, 0);
}

int main(int argc, char * argv[])
{
   xmlTextReaderPtr reader = xmlReaderForMemory("          ", 10, "noname.xml", NULL, 0);

#if 1
   boost::thread processCommandsThread(processCommands);
#else
   processCommands();
#endif

   while(1)
   {
      Sleep(1);
   }

    return 0;
}


      



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]