[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (work2) now available
- From: William Ahern <william@...>
- Date: Thu, 3 Apr 2014 11:53:45 -0700
On Thu, Apr 03, 2014 at 10:10:44AM -0300, Roberto Ierusalimschy wrote:
> > > -#if defined(LUA_USE_POSIX)
> > > +#if defined(LUA_USE_POSIX) && (!defined(__sun) || defined(_REENTRANT))
> >
> > I prefer just adding _REENTRANT to the Solaris target CPPFLAGS, otherwise
> > people will needlessly get different behavior on Solaris than on other Unix
> > systems. Few will know to enable it, and there's no indication that they're
> > getting less-than-desirable behavior.
>
> The only difference is that they are getting "non-reentrant" code
> (actually non thread-safe code), because they did not ask for it. This
> already happens in all versions of Lua. Should everybody get reentrant
> code, even if not needed? The Solaris documentation does not recommend
> that:
But they didn't have to ask for it on any other system; they got it
automatically merely by the fact that the Makefile didn't disable it.
flockfile is part of the threading API, and unfortunately on Solaris you
have to explicitly ask for threaded interfaces not defined in <pthreads.h>
> http://docs.oracle.com/cd/E19683-01/806-6867/compile-4/index.html
>
> Note ???
> Compile single-threaded applications, not linked with either of the
> thread libraries (libthread.so.1 or libpthread.so.1), without the
> -D_REENTRANT flag. This eliminates performance degradation incurred when
> macros, such as putc(3s), are converted into reentrant function calls.
Systems like Linux don't even use macros for putc anymore. They're always
function calls so that when a library (say, a Lua module) spawns a thread
you don't get random crashes. Example:
$ cpp <<-'EOF' | tail -n5
> #include <stdio.h>
> int main(void) {
> putchar('a');
> getc();
> }
> EOF
# 2 "<stdin>" 2
int main(void) {
putchar('a');
_IO_getc ();
}
Solaris is being anachronistic. One way or another Solaris needs to be built
specially. But which way to go--toward parity with other systems, or leave
it regressed but with an ugly #ifdef in the source code?
Full disclosure: I'm not impartial because my cqueues module includes
bindings for the pthreads API, and my openssl and unix modules also strive
to be thread-safe. I would like to see upstream Lua build a thread-safe
interpreter by default.
But I understand that Lua may have different motivations, priorities, and
goals. So I'm cool with whatever solution you commit =)
>
> > At least with -work3 compilation fails.
>
> ??
Oops. I meant at least it issues a diagnostic about flockfile.