bug-gnulib
[Top][All Lists]
Advanced

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

Re: setjmp doc fixes


From: Bruno Haible
Subject: Re: setjmp doc fixes
Date: Sat, 7 Jun 2008 01:53:17 +0200
User-agent: KMail/1.5.4

Eric Blake wrote:
> Meanwhile, I'm committing this (POSIX states 
> that the various *setjmp are allowed to be only a macro; but *longjmp must be 
> linkable functions):

Thanks for the doc fixes. Most of this symbol / platform presence/absence
matrix was generated automatically. On some macro-like or inlined symbols
the results were not right.

Regarding _setjmp and _longjmp you say that they are "obsolete". I disagree
for two reasons:

  1) On glibc systems, setjmp() does not save the signal mask, but when
     _BSD_SOURCE is defined, setjmp() _does_ save the signal mask.
     So if I want to save the registers but not the signal mask, independently
     of the CFLAGS in use, I *must* use '_setjmp', not 'setjmp', on glibc 
systems.

  2) _setjmp is always faster or same-speed as setjmp; _setjmp can be 30 times
     faster than setjmp. I did these benchmarks just two weeks ago, comparing
     setjmp() versus _setjmp() versus sigsetjmp(.,0). (Times are in micro-
     seconds.)

                              setjmp           _setjmp         sigsetjmp(.,0)
                          saves mask/time   saves mask/time   saves mask/time

    Linux                     N  0.035          N  0.035          N  0.080
    Linux -D_BSD_SOURCE       Y  0.88           N  0.035          N  0.079
    FreeBSD 6.2               Y  0.56           N  0.017          N  0.019
    OpenBSD 4.0               Y  0.39           N  0.016          N  0.019
    HP-UX 11                  Y  1.88           N  0.13           N  1.98

      See <http://article.gmane.org/gmane.lisp.clisp.devel/18227> for
      details.

Conclusion: There's no adequate equivalent for _setjmp.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]