Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #66456

setjmp, longjmp, parser state, threads

From "Morten W. Petersen" <morphex@gmail.com>
Newsgroups comp.lang.c
Subject setjmp, longjmp, parser state, threads
Date 2015-07-27 20:50 +0200
Organization Aioe.org NNTP Server
Message-ID <mp5uhv$b7c$1@speranza.aioe.org> (permalink)

Show all headers | View raw


Hi there. :)

I'm writing an XML parser, which will also be built to support threads.

Now, I've been looking at bit at threads, parser state, setjmp and
longjmp.

Threads will be an important optional feature to minimize the amount of
time it takes to parse an XML file.

I haven't used setjmp and longjmp before, but it looks like some
variable has to be passed around, something I was thinking (or
hoping) it wouldn't.  It also looks like it saves the current
state of the program on setjmp, and I don't know how threads
would mix with that.

So far, threading is a feature that will speed things up, but
it will also complicate things.  So my plan is to have a parser
object (with an error flag and a pointer to the buffer) that will
be passed around.  And if any intolerable error pops up when parsing
the XML, the error flag will be set on the parser object.  The parser
will also have a Unicode string pointer that points to an explanation
of what went wrong.

If an error pops up that can't be handled, just jump out of the parsing
at the earliest and flag an error.  Multiple threads might encounter
errors and flip the flag to something else than 0, and multiple threads
might set an error message.

Now, the point of the parser isn't to parse an XML document and point
out all the errors. The point is to parse things correct, fast and
as efficiently as possible.  If one or the other message pops up
with the error that's good enough for now.

Now, the flag and Unicode string pointer will have to be thread-safe,
so it must be possible to lock them..  that's fine and OK.

Am I right in thinking that since the program will use threads at some
point, it is a good idea to have a parser object instead of a setjmp /
longjmp thing?

The project is here:

https://github.com/morphex/smash_xml

-Morten

Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

setjmp, longjmp, parser state, threads "Morten W. Petersen" <morphex@gmail.com> - 2015-07-27 20:50 +0200
  Re: setjmp, longjmp, parser state, threads Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-28 00:22 +0100
    Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads] Jeff Higgins <jeff@invalid.invalid> - 2015-07-27 21:00 -0400
      Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state,   threads] Ian Collins <ian-news@hotmail.com> - 2015-07-28 13:57 +1200
        Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state,   threads] Jeff Higgins <jeff@invalid.invalid> - 2015-07-27 22:13 -0400
          Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state,     threads] Ian Collins <ian-news@hotmail.com> - 2015-07-28 17:12 +1200
            Re: OT - XML Parallel Parsing Jeff Higgins <jeff@invalid.invalid> - 2015-07-28 09:46 -0400
          Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads] "Morten W. Petersen" <morphex@gmail.com> - 2015-07-28 10:07 +0200
            Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads] raltbos@xs4all.nl (Richard Bos) - 2015-07-28 09:28 +0000
              Patents, was [Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads]] "Morten W. Petersen" <morphex@gmail.com> - 2015-07-28 11:41 +0200
                Re: Patents, was [Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads]] Stephen Sprunk <stephen@sprunk.org> - 2015-07-28 20:53 -0500
                Re: Patents, was [Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads]] "Morten W. Petersen" <morphex@gmail.com> - 2015-07-29 05:15 +0200
                Re: Patents, was [Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads]] Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-07-28 22:34 -0600
      Re: OT - XML Parallel Parsing, was [Re: setjmp, longjmp, parser state, threads] Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-28 03:06 +0100
    Re: setjmp, longjmp, parser state, threads "Morten W. Petersen" <morphex@gmail.com> - 2015-07-28 10:44 +0200
      Re: setjmp, longjmp, parser state, threads Ian Collins <ian-news@hotmail.com> - 2015-07-28 22:14 +1200
        Re: setjmp, longjmp, parser state, threads "Morten W. Petersen" <morphex@gmail.com> - 2015-07-28 15:17 +0200
      Re: setjmp, longjmp, parser state, threads Jeff Higgins <jeff@invalid.invalid> - 2015-07-28 08:35 -0400
      Re: setjmp, longjmp, parser state, threads James Kuyper <jameskuyper@verizon.net> - 2015-07-28 10:29 -0400
        Re: setjmp, longjmp, parser state, threads "Morten W. Petersen" <morphex@gmail.com> - 2015-07-28 16:39 +0200
  Re: setjmp, longjmp, parser state, threads jadill33@gmail.com - 2015-07-28 06:47 -0700
    Re: setjmp, longjmp, parser state, threads "Morten W. Petersen" <morphex@gmail.com> - 2015-07-28 16:56 +0200
      Re: setjmp, longjmp, parser state, threads Noob <root@127.0.0.1> - 2015-07-28 18:04 +0200
      Re: setjmp, longjmp, parser state, threads jadill33@gmail.com - 2015-07-28 10:53 -0700
        Re: setjmp, longjmp, parser state, threads "Morten W. Petersen" <morphex@gmail.com> - 2015-07-29 04:59 +0200
  Re: setjmp, longjmp, parser state, threads Bartc <bc@freeuk.com> - 2015-07-28 16:29 +0100

csiph-web