Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, I'd like to upgrade my flex/bison generated parser to a multi threaded (pthreads) parser. I know that I have to create a reentrant flex wrapper and use %pure_parser in bison. I need to stop parsing (and do some other things) whenever a syntax error occurs. However yyerror(...) does not have any parameter which would help to find out in which thread the syntax error occured. I could use pthread_self() and associate the necessary data with the thread id, but this solution seems somewhat awkward. Is there a better way to do it? Thanks in advance, Tamas Sarlos, Budapest, Hungary
Post Follow-up to this message> error occurs. However yyerror(...) does not have any parameter which > would help to find out in which thread the syntax error occured. Hi Tamas, #define yyerror(s) yyerror_r(s, thread_specific_info) -John M
Post Follow-up to this messageOn Wed, 28 Jul 2004, Tamas Sarlos wrote: > > I'd like to upgrade my flex/bison generated parser to a multi threaded > (pthreads) parser. ... > Is there a better > way to do it? I suggest using thread-specific data (pthread_key_create(), pthread_setspecific() and pthread_getspecific()). In my parser, the object passed to `yyparse()' via a `void*' contains a pointer to the object containing the thread-specific data, so I don't actu ally need to call `pthread_getspecific()' very often. If you want to look at my code, it's available under http://savannah.gnu.org/cgi-bin/vie...df/3dldf/Group/ Laurence Finston GNU 3DLDF maintainer http://www.gnu.org/software/3dldf
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.