Browse Source

Fix thread flags on Solaris

Also on other platforms use -pthread for compiling commands not just
linking because I noticed in the gcc(1) man page

  -pthread
      Adds support for multithreading with the pthreads library. This
      option sets flags for both the preprocessor and linker.

Removing the errno check in deps/coupling because it was a hack
(e165859c2e) added to fix stdio problems.
Without adding -threads, errno is not thread local, and coupling was not
correctly checking the errno. It appears -mt does nothing to gcc/solaris.
v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
4279725d79
  1. 8
      deps/coupling/coupling.c
  2. 21
      wscript

8
deps/coupling/coupling.c

@ -180,7 +180,7 @@ pull_pump (int pullfd, int pushfd)
/* eof */ /* eof */
close(pullfd); close(pullfd);
pullfd = -1; pullfd = -1;
} else if (r < 0 && errno && errno != EINTR && errno != EAGAIN) { } else if (r < 0 && errno != EINTR && errno != EAGAIN) {
/* error */ /* error */
perror("pull_pump read()"); perror("pull_pump read()");
close(pullfd); close(pullfd);
@ -192,7 +192,7 @@ pull_pump (int pullfd, int pushfd)
/* non-blocking write() to the pipe */ /* non-blocking write() to the pipe */
r = ring_buffer_push(&ring, pushfd); r = ring_buffer_push(&ring, pushfd);
if (r < 0 && errno && errno != EAGAIN && errno != EINTR) { if (r < 0 && errno != EAGAIN && errno != EINTR) {
if (errno == EPIPE) { if (errno == EPIPE) {
/* This happens if someone closes the other end of the pipe. This /* This happens if someone closes the other end of the pipe. This
* is a normal forced close of STDIN. Hopefully there wasn't data * is a normal forced close of STDIN. Hopefully there wasn't data
@ -274,7 +274,7 @@ push_pump (int pullfd, int pushfd)
/* eof */ /* eof */
close(pullfd); close(pullfd);
pullfd = -1; pullfd = -1;
} else if (r < 0 && errno && errno != EINTR && errno != EAGAIN) { } else if (r < 0 && errno != EINTR && errno != EAGAIN) {
perror("push_pump read()"); perror("push_pump read()");
close(pullfd); close(pullfd);
pullfd = -1; pullfd = -1;
@ -288,7 +288,7 @@ push_pump (int pullfd, int pushfd)
/* If there was a problem, just exit the entire function */ /* If there was a problem, just exit the entire function */
if (r < 0 && errno && errno != EINTR && errno != EAGAIN) { if (r < 0 && errno != EINTR && errno != EAGAIN) {
close(pushfd); close(pushfd);
close(pullfd); close(pullfd);
pushfd = pullfd = -1; pushfd = pullfd = -1;

21
wscript

@ -168,6 +168,16 @@ def configure(conf):
conf.define("HAVE_CONFIG_H", 1) conf.define("HAVE_CONFIG_H", 1)
if sys.platform.startswith("sunos"):
conf.env.append_value ('CCFLAGS', '-threads')
conf.env.append_value ('CXXFLAGS', '-threads')
#conf.env.append_value ('LINKFLAGS', ' -threads')
else:
threadflags='-pthread'
conf.env.append_value ('CCFLAGS', threadflags)
conf.env.append_value ('CXXFLAGS', threadflags)
conf.env.append_value ('LINKFLAGS', threadflags)
conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64)) conf.env.append_value("CCFLAGS", "-DX_STACKSIZE=%d" % (1024*64))
# LFS # LFS
@ -272,10 +282,8 @@ def build_v8(bld):
v8.uselib = "EXECINFO" v8.uselib = "EXECINFO"
bld.env["CPPPATH_V8"] = "deps/v8/include" bld.env["CPPPATH_V8"] = "deps/v8/include"
t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target) t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target)
if sys.platform.startswith("sunos"): bld.env_of_name('default').append_value("LINKFLAGS_V8", t)
bld.env_of_name('default')["LINKFLAGS_V8"] = ["-mt", t]
else:
bld.env_of_name('default')["LINKFLAGS_V8"] = ["-pthread", t]
### v8 debug ### v8 debug
if bld.env["USE_DEBUG"]: if bld.env["USE_DEBUG"]:
@ -284,10 +292,7 @@ def build_v8(bld):
v8_debug.target = bld.env["staticlib_PATTERN"] % "v8_g" v8_debug.target = bld.env["staticlib_PATTERN"] % "v8_g"
v8_debug.uselib = "EXECINFO" v8_debug.uselib = "EXECINFO"
t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target) t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target)
if sys.platform.startswith("sunos"): bld.env_of_name('debug').append_value("LINKFLAGS_V8", t)
bld.env_of_name('debug')["LINKFLAGS_V8"] = ["-mt", t]
else:
bld.env_of_name('debug')["LINKFLAGS_V8"] = ["-pthread", t]
bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h') bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')

Loading…
Cancel
Save