Hi,
Stefan Sperling writes:
> The first is that I use OpenBSD and OpenBSD's threading implementation
> is a pure userspace implementation. It has to set stdin and stdout to
> non-blocking -- otherwise, whenever a thread blocks for i/o in the kernel the
> userspace thread-scheduler would also be blocked and couldn't switch to
> another thread. However, non-blocking stdio makes it very inconvenient
> to do things like "svn diff | less" because less expects blocking reads.
> The lines get garbled when you start scrolling in less.
> (Kernel thread support is being worked on by OpenBSD developers.)
>
> The second reason is that virtually nobody else is compiling and running
> without thread support in APR. This sometimes causes thread-less cases
> to be overlooked. Most recently I found a bug in the performance branch
> due to this. So it's good to have test coverage for the thread-less case.
> Because of this I will likely continue compiling APR thread-less even when
> OpenBSD finally gets kernel thread support.
Thanks for the explanation! Unfortunately, I'm not able to get the
build to break with threading disabled anymore :| Have to run a few
more experiments before I can conclusively say what went wrong back
then.
> Your patch is too short. It's missing at least one hunk. Because if threading
> is enabled for APR, you should also enable it for sqlite and any other
> dependencies affected.
Ok, got it. Here's my second try.
[[[
Makefile.svn: Optionally allow building with threading support
* tools/dev/unix-build/Makefile.svn: Add a new ENABLE_THREADING
variable to control whether APR and sqlite should be built with
threading support.
]]]
Index: tools/dev/unix-build/Makefile.svn
===================================================================
--- tools/dev/unix-build/Makefile.svn (revision 1040658)
+++ tools/dev/unix-build/Makefile.svn (working copy)
@@ -3,6 +3,7 @@
# WARNING: This may or may not work on your system. This Makefile is
# an example, rather than a ready-made universal solution.
+ENABLE_THREADING ?= no # OpenBSD doesn't have kernel threads for example
ENABLE_PYTHON_BINDINGS ?= yes
ENABLE_RUBY_BINDINGS ?= yes
ENABLE_PERL_BINDINGS ?= yes
@@ -241,12 +242,21 @@
| sed -e '/^.*APR_ADDTO(CPPFLAGS, \[-D_POSIX_THREADS\]).*$$/d' \
> $(APR_SRCDIR)/build/apr_hints.m4
cd $(APR_SRCDIR) && ./buildconf
- cd $(APR_OBJDIR) \
- && env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
- $(APR_SRCDIR)/configure \
- --prefix=$(PREFIX)/apr \
- --enable-maintainer-mode \
- --disable-threads
+ if [ $(ENABLE_THREADING) = yes ]; then \
+ cd $(APR_OBJDIR) \
+ && env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
+ $(APR_SRCDIR)/configure \
+ --prefix=$(PREFIX)/apr \
+ --enable-maintainer-mode \
+ --enable-threads; \
+ else \
+ cd $(APR_OBJDIR) \
+ && env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
+ $(APR_SRCDIR)/configure \
+ --prefix=$(PREFIX)/apr \
+ --enable-maintainer-mode \
+ --disable-threads; \
+ fi;
touch $@
# compile apr
@@ -706,12 +716,21 @@
# configure sqlite
$(SQLITE_OBJDIR)/.configured: $(SQLITE_OBJDIR)/.retrieved
- cd $(SQLITE_OBJDIR) \
- && env CFLAGS="-g $(PROFILE_CFLAGS)" \
- $(SQLITE_SRCDIR)/configure \
- --prefix=$(PREFIX)/sqlite \
- --disable-tcl \
- --disable-threadsafe
+ if [ $(ENABLE_THREADING) = yes ]; then \
+ cd $(SQLITE_OBJDIR) \
+ && env CFLAGS="-g $(PROFILE_CFLAGS)" \
+ $(SQLITE_SRCDIR)/configure \
+ --prefix=$(PREFIX)/sqlite \
+ --disable-tcl \
+ --enable-threadsafe; \
+ else \
+ cd $(SQLITE_OBJDIR) \
+ && env CFLAGS="-g $(PROFILE_CFLAGS)" \
+ $(SQLITE_SRCDIR)/configure \
+ --prefix=$(PREFIX)/sqlite \
+ --disable-tcl \
+ --disable-threadsafe; \
+ fi;
touch $@
# compile sqlite
Received on 2010-11-30 19:44:40 CET