aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 18:47:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 18:47:54 +0000
commit9c4b5b39a828509e752cb7d2888ff6e49d7694a6 (patch)
treec2a3c94b4b1e695a6a9f528a8b588814d25032a8
parent682a8eb100360f6c2d68f2c960bcf3f9bf9db5f3 (diff)
downloadpaludis-9c4b5b39a828509e752cb7d2888ff6e49d7694a6.tar.gz
paludis-9c4b5b39a828509e752cb7d2888ff6e49d7694a6.tar.xz
Threads are now mandatory
-rw-r--r--configure.ac102
-rw-r--r--doc/api/cplusplus/groups.doxygen3
-rw-r--r--doc/configuration/envvars.html.part7
-rw-r--r--paludis/repositories/e/qa/qa_controller.cc8
-rw-r--r--paludis/sync_task.cc4
-rw-r--r--paludis/util/action_queue.cc36
-rw-r--r--paludis/util/attributes.hh8
-rw-r--r--paludis/util/condition_variable.cc40
-rw-r--r--paludis/util/condition_variable.hh7
-rw-r--r--paludis/util/log.cc20
-rw-r--r--paludis/util/mutex.cc43
-rw-r--r--paludis/util/mutex.hh13
-rw-r--r--paludis/util/system.cc20
-rw-r--r--paludis/util/system_TEST.cc17
-rw-r--r--paludis/util/thread.cc22
-rw-r--r--paludis/util/thread.hh7
-rw-r--r--ruby/repository.cc21
-rw-r--r--src/clients/paludis/command_line.cc5
-rw-r--r--src/clients/paludis/sync.cc2
19 files changed, 63 insertions, 322 deletions
diff --git a/configure.ac b/configure.ac
index 80fc6d1..7f92b9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -552,34 +552,26 @@ then
AC_MSG_RESULT([no])
fi
-AC_MSG_CHECKING([whether to enable threads])
PTHREAD_LIBS=""
RT_LIBS=""
-AC_ARG_ENABLE([threads],
- AS_HELP_STRING([--enable-threads], [Enable threads (experimental)]),
- [ENABLE_THREADS=$enableval],
- [ENABLE_THREADS=no])
-AC_MSG_RESULT([$ENABLE_THREADS])
-AC_SUBST([ENABLE_THREADS])
-if test "x$ENABLE_THREADS" = "xyes" ; then
- AC_MSG_CHECKING([for compiler __thread support])
- AC_COMPILE_IFELSE([
+AC_MSG_CHECKING([for compiler __thread support])
+AC_COMPILE_IFELSE([
int main(int, char **)
{
static __thread int x(0);
return x;
}
],
- [AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])
- AC_MSG_ERROR([--enable-threads requires compiler __thread support])])
-
- AC_MSG_CHECKING([whether -pthread -lpthread gets us posix threads])
- save_CXXFLAGS=$CXXFLAGS
- save_LDFLAGS=$LDFLAGS
- CXXFLAGS="$CXXFLAGS -pthread"
- LDFLAGS="$LDFLAGS -pthread -lpthread"
- AC_LINK_IFELSE([
+[AC_MSG_RESULT([yes])],
+[AC_MSG_RESULT([no])
+AC_MSG_ERROR([Your compiler doesn't support __thread])])
+
+AC_MSG_CHECKING([whether -pthread -lpthread gets us posix threads])
+save_CXXFLAGS=$CXXFLAGS
+save_LDFLAGS=$LDFLAGS
+CXXFLAGS="$CXXFLAGS -pthread"
+LDFLAGS="$LDFLAGS -pthread -lpthread"
+AC_LINK_IFELSE([
#include <pthread.h>
int main(int, char **)
{
@@ -588,19 +580,18 @@ int main(int, char **)
return 0;
}
],
- [AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])
- AC_MSG_ERROR([don't know how to enable pthreads for your compiler])])
- CXXFLAGS=$save_CXXFLAGS
- LDFLAGS=$save_LDFLAGS
- PALUDIS_CXXFLAGS="$PALUDIS_CXXFLAGS -DPALUDIS_ENABLE_THREADS=1 -pthread"
- PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -DPALUDIS_ENABLE_THREADS=1 -pthread"
- PTHREAD_LIBS="-pthread -lpthread"
- PALUDIS_PC_LIBS="${PALUDIS_PC_LIBS} -pthread -lpthread"
- PALUDIS_ENABLE_THREADS=1
-
- AC_MSG_CHECKING([how to get clock_gettime])
- AC_LINK_IFELSE([
+[AC_MSG_RESULT([yes])],
+[AC_MSG_RESULT([no])
+AC_MSG_ERROR([don't know how to enable pthreads for your compiler])])
+CXXFLAGS=$save_CXXFLAGS
+LDFLAGS=$save_LDFLAGS
+PALUDIS_CXXFLAGS="$PALUDIS_CXXFLAGS -pthread"
+PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -pthread"
+PTHREAD_LIBS="-pthread -lpthread"
+PALUDIS_PC_LIBS="${PALUDIS_PC_LIBS} -pthread -lpthread"
+
+AC_MSG_CHECKING([how to get clock_gettime])
+AC_LINK_IFELSE([
#include <time.h>
#include <sys/time.h>
int main(int, char **)
@@ -609,10 +600,10 @@ int main(int, char **)
clock_gettime(CLOCK_REALTIME, &t);
}
],
- [AC_MSG_RESULT([already have it])],
- [save_LDFLAGS=$LDFLAGS
- LDFLAGS="-lrt $LDFLAGS"
- AC_LINK_IFELSE([
+ [AC_MSG_RESULT([already have it])],
+ [save_LDFLAGS=$LDFLAGS
+ LDFLAGS="-lrt $LDFLAGS"
+ AC_LINK_IFELSE([
#include <time.h>
#include <sys/time.h>
int main(int, char **)
@@ -621,21 +612,17 @@ int main(int, char **)
clock_gettime(CLOCK_REALTIME, &t);
}
],
- [
- AC_MSG_RESULT([-lrt])
- RT_LIBS="-lrt"
- ],
- [
- AC_MSG_RESULT([don't know])
- AC_MSG_ERROR([enable-threads needs clock_gettime])
- ])
- LDFLAGS=$save_LDFLAGS
- ])
+ [
+ AC_MSG_RESULT([-lrt])
+ RT_LIBS="-lrt"
+ ],
+ [
+ AC_MSG_RESULT([don't know])
+ AC_MSG_ERROR([don't know how to get clock_gettime])
+ ])
+ LDFLAGS=$save_LDFLAGS
+ ])
-else
- PALUDIS_ENABLE_THREADS=0
-fi
-AC_SUBST([PALUDIS_ENABLE_THREADS])
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([RT_LIBS])
@@ -1343,19 +1330,6 @@ AC_SUBST([ALL_CLIENTS])
AC_SUBST([ALL_CLIENTS_HTML])
AC_SUBST([BUILD_CLIENTS])
-AC_MSG_CHECKING([whether threads must be enabled])
-if echo $clients | tr ' ' '\n' | grep '^cave$' >/dev/null ; then
- AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([whether threads are enabled])
- if test x$ENABLE_THREADS = xyes ; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_ERROR([cave requires --enable-threads])
- fi
-else
- AC_MSG_RESULT([no])
-fi
-
if echo $clients | tr ' ' '\n' | grep '^inquisitio$' >/dev/null ; then
need_pcrepp_check=yes
fi
diff --git a/doc/api/cplusplus/groups.doxygen b/doc/api/cplusplus/groups.doxygen
index a44e6d0..811eaef 100644
--- a/doc/api/cplusplus/groups.doxygen
+++ b/doc/api/cplusplus/groups.doxygen
@@ -367,8 +367,7 @@ using namespace paludis;
*
* \ingroup g_utils
*
- * Paludis includes some basic thread classes. Most users will not have threads
- * enabled at the moment.
+ * Paludis includes some basic thread classes.
*
* \section Examples
*
diff --git a/doc/configuration/envvars.html.part b/doc/configuration/envvars.html.part
index 27e4a04..1e70746 100644
--- a/doc/configuration/envvars.html.part
+++ b/doc/configuration/envvars.html.part
@@ -70,13 +70,6 @@ can be dangerous and may break things; many of these variables exist mainly for
<dt><code>PALUDIS_REPOSITORY_SO_DIR</code></dt>
<dd>Where Paludis looks to find repository .so files.</dd>
- <dt><code>PALUDIS_FUTURE_THREAD_COUNT</code></dt>
- <dd>(Highly experimental, only if threads are enabled) The number of threads used to precalculate futures.</dd>
-
- <dt><code>PALUDIS_IDLE_THREAD_COUNT</code></dt>
- <dd>(Highly experimental, only if threads are enabled) The number of low priority threads used to precalculate
- values that might be used in the future.</dd>
-
<dt><code>PALUDIS_OUTPUTWRAPPER_DIR</code></dt>
<dd>Where Paludis looks to find outputwrapper.</dd>
diff --git a/paludis/repositories/e/qa/qa_controller.cc b/paludis/repositories/e/qa/qa_controller.cc
index 2b94739..ae64850 100644
--- a/paludis/repositories/e/qa/qa_controller.cc
+++ b/paludis/repositories/e/qa/qa_controller.cc
@@ -303,10 +303,6 @@ QAController::_check_category(const CategoryNamePart c, const std::tr1::shared_p
if (work_item)
{
-#ifndef PALUDIS_ENABLE_THREADS
- _imp->reporter.status("Pending: " + stringify(_imp->cats_pool.size()) + " full categories, "
- + stringify(_imp->pkgs_pool.size()) + " packages in '" + stringify(_imp->repo->name()) + "'");
-#endif
work_item();
}
else
@@ -425,14 +421,10 @@ QAController::run()
* start taking packages from another worker's category. */
std::tr1::shared_ptr<const CategoryNamePartSet> cats(_imp->repo->category_names());
std::copy(cats->begin(), cats->end(), std::inserter(_imp->cats_pool, _imp->cats_pool.begin()));
-#ifdef PALUDIS_ENABLE_THREADS
ThreadPool workers;
for (int x(0) ; x < 5 ; ++x)
workers.create_thread(std::tr1::bind(&QAController::_worker, this));
workers.create_thread(std::tr1::bind(&QAController::_status_worker, this));
-#else
- _worker();
-#endif
}
catch (const InternalError &)
{
diff --git a/paludis/sync_task.cc b/paludis/sync_task.cc
index 904eb04..f4e3a5e 100644
--- a/paludis/sync_task.cc
+++ b/paludis/sync_task.cc
@@ -174,7 +174,6 @@ SyncTask::execute()
ItemSyncer s(std::distance(_imp->targets.begin(), _imp->targets.end()), _imp->env, this);
using namespace std::tr1::placeholders;
-#ifdef PALUDIS_ENABLE_THREADS
if (_imp->parallel)
{
ActionQueue actions(5);
@@ -184,9 +183,6 @@ SyncTask::execute()
}
else
std::for_each(_imp->targets.begin(), _imp->targets.end(), std::tr1::bind(&ItemSyncer::sync, &s, _1));
-#else
- std::for_each(_imp->targets.begin(), _imp->targets.end(), std::tr1::bind(&ItemSyncer::sync, &s, _1));
-#endif
on_sync_all_post();
if (0 !=
diff --git a/paludis/util/action_queue.cc b/paludis/util/action_queue.cc
index 501ad83..f16494a 100644
--- a/paludis/util/action_queue.cc
+++ b/paludis/util/action_queue.cc
@@ -19,14 +19,11 @@
#include <paludis/util/action_queue.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
-
-#ifdef PALUDIS_ENABLE_THREADS
-# include <paludis/util/mutex.hh>
-# include <paludis/util/condition_variable.hh>
-# include <paludis/util/thread_pool.hh>
-# include <paludis/util/thread.hh>
-# include <deque>
-#endif
+#include <paludis/util/mutex.hh>
+#include <paludis/util/condition_variable.hh>
+#include <paludis/util/thread_pool.hh>
+#include <paludis/util/thread.hh>
+#include <deque>
using namespace paludis;
@@ -37,7 +34,6 @@ namespace paludis
template <>
struct Implementation<ActionQueue>
{
-#ifdef PALUDIS_ENABLE_THREADS
Mutex mutex;
ConditionVariable condition;
std::deque<std::tr1::function<void () throw ()> > queue;
@@ -89,33 +85,22 @@ namespace paludis
else
threads.create_thread(std::tr1::bind(std::tr1::mem_fn(&Implementation::thread_func), this));
}
-#endif
};
}
-#ifdef PALUDIS_ENABLE_THREADS
ActionQueue::ActionQueue(const unsigned n_threads, const bool nice, const bool limit_size) :
PrivateImplementationPattern<ActionQueue>(new Implementation<ActionQueue>(n_threads, nice, limit_size))
{
}
-#else
-ActionQueue::ActionQueue(const unsigned, const bool, const bool) :
- PrivateImplementationPattern<ActionQueue>(new Implementation<ActionQueue>())
-{
-}
-#endif
ActionQueue::~ActionQueue()
{
-#ifdef PALUDIS_ENABLE_THREADS
enqueue(std::tr1::bind(std::tr1::mem_fn(&Implementation<ActionQueue>::finish), _imp.get()));
-#endif
}
void
ActionQueue::enqueue(const std::tr1::function<void () throw ()> & f)
{
-#ifdef PALUDIS_ENABLE_THREADS
Lock l(_imp->mutex);
if ((! _imp->limit_size) || (_imp->queue.size() < 1000))
{
@@ -124,40 +109,29 @@ ActionQueue::enqueue(const std::tr1::function<void () throw ()> & f)
}
else
f();
-#else
- f();
-#endif
}
void
ActionQueue::complete_pending()
{
-#ifdef PALUDIS_ENABLE_THREADS
ConditionVariable c;
Mutex m;
Lock l(m);
enqueue(std::tr1::bind(std::tr1::mem_fn(&ConditionVariable::acquire_then_signal), &c, std::tr1::ref(m)));
c.wait(m);
-#endif
}
void
ActionQueue::forget_pending()
{
-#ifdef PALUDIS_ENABLE_THREADS
Lock l(_imp->mutex);
_imp->queue.clear();
-#endif
}
unsigned
ActionQueue::number_of_threads() const
{
-#ifdef PALUDIS_ENABLE_THREADS
return _imp->threads.number_of_threads();
-#else
- return 0;
-#endif
}
diff --git a/paludis/util/attributes.hh b/paludis/util/attributes.hh
index 166e1c2..fa0f030 100644
--- a/paludis/util/attributes.hh
+++ b/paludis/util/attributes.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -72,10 +72,6 @@
# define PALUDIS_HIDDEN
#endif
-#ifdef PALUDIS_ENABLE_THREADS
-# define PALUDIS_TLS static __thread
-#else
-# define PALUDIS_TLS static
-#endif
+#define PALUDIS_TLS static __thread
#endif
diff --git a/paludis/util/condition_variable.cc b/paludis/util/condition_variable.cc
index a56f780..efabd1c 100644
--- a/paludis/util/condition_variable.cc
+++ b/paludis/util/condition_variable.cc
@@ -28,8 +28,6 @@
using namespace paludis;
-#ifdef PALUDIS_ENABLE_THREADS
-
ConditionVariable::ConditionVariable() :
_cond(new pthread_cond_t)
{
@@ -86,41 +84,3 @@ ConditionVariable::timed_wait(Mutex & m, const unsigned n)
}
}
-#else
-
-ConditionVariable::ConditionVariable()
-{
-}
-
-ConditionVariable::~ConditionVariable()
-{
-}
-
-void
-ConditionVariable::broadcast()
-{
-}
-
-void
-ConditionVariable::signal()
-{
-}
-
-void
-ConditionVariable::acquire_then_signal(Mutex &)
-{
-}
-
-void
-ConditionVariable::wait(Mutex &)
-{
-}
-
-bool
-ConditionVariable::timed_wait(Mutex &, const unsigned)
-{
- return true;
-}
-
-#endif
-
diff --git a/paludis/util/condition_variable.hh b/paludis/util/condition_variable.hh
index 4e8c73d..87ee150 100644
--- a/paludis/util/condition_variable.hh
+++ b/paludis/util/condition_variable.hh
@@ -22,10 +22,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/mutex.hh>
-
-#ifdef PALUDIS_ENABLE_THREADS
-# include <pthread.h>
-#endif
+#include <pthread.h>
/** \file
* Declarations for the ConditionVariable class.
@@ -54,9 +51,7 @@ namespace paludis
ConditionVariable(const ConditionVariable &);
ConditionVariable & operator= (const ConditionVariable &);
-#ifdef PALUDIS_ENABLE_THREADS
pthread_cond_t * const _cond;
-#endif
public:
///\name Basic operations
diff --git a/paludis/util/log.cc b/paludis/util/log.cc
index 45d4d23..d4be1d8 100644
--- a/paludis/util/log.cc
+++ b/paludis/util/log.cc
@@ -26,13 +26,11 @@
#include <paludis/util/action_queue.hh>
#include "config.h"
-#ifdef PALUDIS_ENABLE_THREADS
-# ifdef __linux__
-# include <sys/time.h>
-# include <sys/resource.h>
-# include <unistd.h>
-# include <sys/syscall.h>
-# endif
+#ifdef __linux__
+# include <sys/time.h>
+# include <sys/resource.h>
+# include <unistd.h>
+# include <sys/syscall.h>
#endif
using namespace paludis;
@@ -157,12 +155,10 @@ Log::_message(const std::string & id, const LogLevel l, const LogContext c, cons
{
if (lc_context == c)
_imp->action_queue.enqueue(std::tr1::bind(std::tr1::mem_fn(&Implementation<Log>::message), _imp.get(), id, l, c,
-#ifdef PALUDIS_ENABLE_THREADS
-# ifdef __linux__
+#ifdef __linux__
"In thread ID '" + stringify(syscall(SYS_gettid)) + "':\n ... " +
-# else
-# warning "Don't know how to get a thread ID on your platform"
-# endif
+#else
+# warning "Don't know how to get a thread ID on your platform"
#endif
Context::backtrace("\n ... "), s));
else
diff --git a/paludis/util/mutex.cc b/paludis/util/mutex.cc
index d57d12a..4fa1566 100644
--- a/paludis/util/mutex.cc
+++ b/paludis/util/mutex.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -24,8 +24,6 @@
using namespace paludis;
-#ifdef PALUDIS_ENABLE_THREADS
-
Mutex::Mutex() :
_attr(new pthread_mutexattr_t),
_mutex(new pthread_mutex_t)
@@ -99,42 +97,3 @@ TryLock::operator() () const
return _mutex;
}
-#else
-
-Mutex::Mutex()
-{
-}
-
-Mutex::~Mutex()
-{
-}
-
-Lock::Lock(Mutex &)
-{
-}
-
-void
-Lock::acquire_then_release_old(Mutex &)
-{
-}
-
-Lock::~Lock()
-{
-}
-
-TryLock::TryLock(Mutex &)
-{
-}
-
-TryLock::~TryLock()
-{
-}
-
-bool
-TryLock::operator() () const
-{
- return true;
-}
-
-#endif
-
diff --git a/paludis/util/mutex.hh b/paludis/util/mutex.hh
index 38586a6..669f9bc 100644
--- a/paludis/util/mutex.hh
+++ b/paludis/util/mutex.hh
@@ -22,10 +22,7 @@
#include <paludis/util/mutex-fwd.hh>
#include <paludis/util/attributes.hh>
-
-#ifdef PALUDIS_ENABLE_THREADS
-# include <pthread.h>
-#endif
+#include <pthread.h>
/**
* Declarations for Mutex, Lock and TryLock.
@@ -51,10 +48,8 @@ namespace paludis
Mutex(const Mutex &);
Mutex & operator= (const Mutex &);
-#ifdef PALUDIS_ENABLE_THREADS
pthread_mutexattr_t * const _attr;
pthread_mutex_t * const _mutex;
-#endif
public:
///\name Basic operations
@@ -65,9 +60,7 @@ namespace paludis
///\}
-#ifdef PALUDIS_ENABLE_THREADS
pthread_mutex_t * posix_mutex() PALUDIS_ATTRIBUTE((warn_unused_result));
-#endif
};
/**
@@ -85,9 +78,7 @@ namespace paludis
Lock(const Lock &);
Lock & operator= (const Lock &);
-#ifdef PALUDIS_ENABLE_THREADS
Mutex * _mutex;
-#endif
public:
///\name Basic operations
@@ -122,9 +113,7 @@ namespace paludis
TryLock(const TryLock &);
TryLock & operator= (const TryLock &);
-#ifdef PALUDIS_ENABLE_THREADS
Mutex * _mutex;
-#endif
public:
///\name Basic operations
diff --git a/paludis/util/system.cc b/paludis/util/system.cc
index 81920f0..e8eb10f 100644
--- a/paludis/util/system.cc
+++ b/paludis/util/system.cc
@@ -368,13 +368,8 @@ paludis::run_command(const Command & cmd)
sigemptyset(&intandterm);
sigaddset(&intandterm, SIGINT);
sigaddset(&intandterm, SIGTERM);
-#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_BLOCK, &intandterm, 0))
throw InternalError(PALUDIS_HERE, "pthread_sigmask failed");
-#else
- if (0 != sigprocmask(SIG_BLOCK, &intandterm, 0))
- throw InternalError(PALUDIS_HERE, "sigprocmask failed");
-#endif
pid_t child(fork());
if (0 == child)
@@ -390,13 +385,8 @@ paludis::run_command(const Command & cmd)
act.sa_flags = 0;
sigaction(SIGINT, &act, 0);
sigaction(SIGTERM, &act, 0);
-#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_UNBLOCK, &intandterm, 0))
std::cerr << "pthread_sigmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
-#else
- if (0 != sigprocmask(SIG_UNBLOCK, &intandterm, 0))
- std::cerr << "sigprocmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
-#endif
try
{
if (cmd.pipe_command_handler())
@@ -522,13 +512,8 @@ paludis::run_command(const Command & cmd)
if (SIG_DFL != old_act.sa_handler && SIG_IGN != old_act.sa_handler)
sigaction(SIGTERM, &act, 0);
-#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_UNBLOCK, &intandterm, 0))
std::cerr << "pthread_sigmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
-#else
- if (0 != sigprocmask(SIG_UNBLOCK, &intandterm, 0))
- std::cerr << "sigprocmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
-#endif
if (cmd.pipe_command_handler())
{
@@ -604,13 +589,8 @@ paludis::run_command(const Command & cmd)
/* Our original pid */
/* Restore SIGINT and SIGTERM handling */
-#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_UNBLOCK, &intandterm, 0))
throw InternalError(PALUDIS_HERE, "pthread_sigmask failed");
-#else
- if (0 != sigprocmask(SIG_UNBLOCK, &intandterm, 0))
- throw InternalError(PALUDIS_HERE, "sigprocmask failed");
-#endif
if (cmd.pipe_command_handler())
{
diff --git a/paludis/util/system_TEST.cc b/paludis/util/system_TEST.cc
index 982be29..28ab73c 100644
--- a/paludis/util/system_TEST.cc
+++ b/paludis/util/system_TEST.cc
@@ -26,41 +26,26 @@
#include <tr1/functional>
#include <cctype>
-
-#ifdef PALUDIS_ENABLE_THREADS
-# include <sched.h>
-#endif
+#include <sched.h>
using namespace test;
using namespace paludis;
namespace
{
-#ifdef PALUDIS_ENABLE_THREADS
void repeatedly_log(bool & b)
-#else
- void repeatedly_log(bool &)
-#endif
{
-#ifdef PALUDIS_ENABLE_THREADS
while (! b)
sched_yield();
-#endif
for (int i(0) ; i < 1000 ; ++i)
Log::get_instance()->message("test.system", ll_debug, lc_context) << "logging stuff";
}
-#ifdef PALUDIS_ENABLE_THREADS
void repeatedly_run_command(bool & b)
-#else
- void repeatedly_run_command(bool &)
-#endif
{
-#ifdef PALUDIS_ENABLE_THREADS
while (! b)
sched_yield();
-#endif
for (int i(0) ; i < 100 ; ++i)
if (0 != run_command("/usr/bin/env true"))
diff --git a/paludis/util/thread.cc b/paludis/util/thread.cc
index 3a5e69f..8c3a2ea 100644
--- a/paludis/util/thread.cc
+++ b/paludis/util/thread.cc
@@ -33,9 +33,6 @@
using namespace paludis;
-#ifdef PALUDIS_ENABLE_THREADS
-
-
Thread::Thread(const std::tr1::function<void () throw ()> & f) :
_thread(new pthread_t),
_func(f)
@@ -81,22 +78,3 @@ Thread::idle_adapter(const std::tr1::function<void () throw ()> & f)
f();
}
-#else
-
-Thread::Thread(const std::tr1::function<void () throw ()> & f)
-{
- f();
-}
-
-Thread::~Thread()
-{
-}
-
-void
-Thread::idle_adapter(const std::tr1::function<void () throw ()> & f)
-{
- f();
-}
-
-#endif
-
diff --git a/paludis/util/thread.hh b/paludis/util/thread.hh
index 126d9cc..415a4de 100644
--- a/paludis/util/thread.hh
+++ b/paludis/util/thread.hh
@@ -23,10 +23,7 @@
#include <paludis/util/attributes.hh>
#include <tr1/functional>
#include <string>
-
-#ifdef PALUDIS_ENABLE_THREADS
-# include <pthread.h>
-#endif
+#include <pthread.h>
/** \file
* Declarations for the Thread class.
@@ -53,13 +50,11 @@ namespace paludis
class PALUDIS_VISIBLE Thread
{
private:
-#ifdef PALUDIS_ENABLE_THREADS
pthread_t * const _thread;
const std::tr1::function<void () throw ()> _func;
std::string _exception;
static void * thread_func(void *);
-#endif
public:
///\name Basic operations
diff --git a/ruby/repository.cc b/ruby/repository.cc
index aad772c..26e6afb 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -28,16 +28,13 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/mutex.hh>
+#include <paludis/util/thread.hh>
+#include <paludis/util/condition_variable.hh>
#include <ruby.h>
#include <list>
#include <tr1/functional>
-#ifdef PALUDIS_ENABLE_THREADS
-# include <paludis/util/mutex.hh>
-# include <paludis/util/thread.hh>
-# include <paludis/util/condition_variable.hh>
-#endif
-
using namespace paludis;
using namespace paludis::ruby;
@@ -561,8 +558,7 @@ namespace
}
};
-#ifdef PALUDIS_ENABLE_THREADS
-# ifdef ENABLE_RUBY_QA
+#ifdef ENABLE_RUBY_QA
struct HackyReporter :
QAReporter
{
@@ -611,7 +607,6 @@ namespace
done = true;
cond.signal();
}
-# endif
#endif
/*
@@ -632,7 +627,6 @@ namespace
if ((**self_ptr).qa_interface())
{
RubyQAReporter qar(&reporter);
-#ifdef PALUDIS_ENABLE_THREADS
/* have to call ruby code in the original thread. icky. */
bool done(false);
std::list<std::tr1::function<void ()> > pending;
@@ -662,13 +656,6 @@ namespace
cond.wait(mutex);
}
}
-#else
- (**self_ptr).qa_interface()->check_qa(qar,
- value_to_qa_check_properties((ignore_if)),
- value_to_qa_check_properties((ignore_unless)),
- static_cast<QAMessageLevel>(NUM2INT(minumum_level)),
- FSEntry(StringValuePtr(dir)));
-#endif
}
#endif
return Qnil;
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index 14f49ae..f71889e 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -74,12 +74,7 @@ CommandLine::CommandLine() :
a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"),
a_resume_command_template(&general_args, "resume-command-template", '\0',
"Save the resume command to a file. If the filename contains 'XXXXXX', use mkstemp(3) to generate the filename"),
-#ifdef PALUDIS_ENABLE_THREADS
a_multitask(&general_args, "multitask", '\0', "Perform tasks in parallel, where supported (currently --sync only)", true),
-#else
- a_multitask(&general_args, "multitask", '\0', "Does nothing. (For compatibility with Paludis when built with thread "
- "support, which you shouldn't be using yet.)", true),
-#endif
a_compact(&general_args, "compact", '\0', "Display output using one line per entry (--install, --query)", true),
query_args(this, "Query options",
diff --git a/src/clients/paludis/sync.cc b/src/clients/paludis/sync.cc
index fc465eb..7dba574 100644
--- a/src/clients/paludis/sync.cc
+++ b/src/clients/paludis/sync.cc
@@ -123,9 +123,7 @@ int do_sync(const std::tr1::shared_ptr<Environment> & env)
Context context("When performing sync action from command line:");
bool parallel(false);
-#ifdef PALUDIS_ENABLE_THREADS
parallel = CommandLine::get_instance()->a_multitask.specified();
-#endif
OurSyncTask task(env, parallel);