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 (e165859c2ebc08b3a00adf4d99003c50ae9936ab) 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.
This commit is contained in:
parent
d52f63d9b2
commit
4279725d79
8
deps/coupling/coupling.c
vendored
8
deps/coupling/coupling.c
vendored
@ -180,7 +180,7 @@ pull_pump (int pullfd, int pushfd)
|
||||
/* eof */
|
||||
close(pullfd);
|
||||
pullfd = -1;
|
||||
} else if (r < 0 && errno && errno != EINTR && errno != EAGAIN) {
|
||||
} else if (r < 0 && errno != EINTR && errno != EAGAIN) {
|
||||
/* error */
|
||||
perror("pull_pump read()");
|
||||
close(pullfd);
|
||||
@ -192,7 +192,7 @@ pull_pump (int pullfd, int pushfd)
|
||||
/* non-blocking write() to the pipe */
|
||||
r = ring_buffer_push(&ring, pushfd);
|
||||
|
||||
if (r < 0 && errno && errno != EAGAIN && errno != EINTR) {
|
||||
if (r < 0 && errno != EAGAIN && errno != EINTR) {
|
||||
if (errno == EPIPE) {
|
||||
/* This happens if someone closes the other end of the pipe. This
|
||||
* is a normal forced close of STDIN. Hopefully there wasn't data
|
||||
@ -274,7 +274,7 @@ push_pump (int pullfd, int pushfd)
|
||||
/* eof */
|
||||
close(pullfd);
|
||||
pullfd = -1;
|
||||
} else if (r < 0 && errno && errno != EINTR && errno != EAGAIN) {
|
||||
} else if (r < 0 && errno != EINTR && errno != EAGAIN) {
|
||||
perror("push_pump read()");
|
||||
close(pullfd);
|
||||
pullfd = -1;
|
||||
@ -288,7 +288,7 @@ push_pump (int pullfd, int pushfd)
|
||||
|
||||
/* 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(pullfd);
|
||||
pushfd = pullfd = -1;
|
||||
|
21
wscript
21
wscript
@ -168,6 +168,16 @@ def configure(conf):
|
||||
|
||||
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))
|
||||
|
||||
# LFS
|
||||
@ -272,10 +282,8 @@ def build_v8(bld):
|
||||
v8.uselib = "EXECINFO"
|
||||
bld.env["CPPPATH_V8"] = "deps/v8/include"
|
||||
t = join(bld.srcnode.abspath(bld.env_of_name("default")), v8.target)
|
||||
if sys.platform.startswith("sunos"):
|
||||
bld.env_of_name('default')["LINKFLAGS_V8"] = ["-mt", t]
|
||||
else:
|
||||
bld.env_of_name('default')["LINKFLAGS_V8"] = ["-pthread", t]
|
||||
bld.env_of_name('default').append_value("LINKFLAGS_V8", t)
|
||||
|
||||
|
||||
### v8 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.uselib = "EXECINFO"
|
||||
t = join(bld.srcnode.abspath(bld.env_of_name("debug")), v8_debug.target)
|
||||
if sys.platform.startswith("sunos"):
|
||||
bld.env_of_name('debug')["LINKFLAGS_V8"] = ["-mt", t]
|
||||
else:
|
||||
bld.env_of_name('debug')["LINKFLAGS_V8"] = ["-pthread", t]
|
||||
bld.env_of_name('debug').append_value("LINKFLAGS_V8", t)
|
||||
|
||||
bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/*.h')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user