Re: Expat lib and Pthreads
Nick MacDonald <[email protected]> Sat, 15 Jan 2011 11:18:20 -0500
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
Potentially, yes... depending on how you intend to keep the state of the two threads separate. You may want to learn about the value of User Data, and set your thread state in some data structure, the pointer of which you would pass into eXpat with XML_SetUserData such that it can pass it along to the handler routines and you can use it in the handlers to get access to your thread specific state. XML_SetUserData(XML_Parser p, void *userData) This sets the user data pointer that gets passed to handlers. Good luck with your project... Nick On Thu, Jan 13, 2011 at 6:09 PM, Mikhail Strizhov <[email protected]> wrote: > I have fully working parsing module and I need to use this module with two > threads (C pthread library) to parse different xml documents simultaneously. > Both threads will launch: > > XML_Parser parser = XML_ParserCreate(NULL); > XML_SetElementHandler(parser, _start_hndl, _end_hndl); > XML_SetCharacterDataHandler(parser,_char_hndl ); > > Will I have inconsistency if both threads will use _start_hndl() and > _end_hndl() handler functions?