summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 1a8a4344..67b28db5 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -48,7 +48,7 @@ alpm_handle_t *_alpm_handle_new(void)
handle->lockfd = -1;
#ifdef HAVE_PTHREAD
- handle->threads = 4;
+ handle->threads = 1;
pthread_mutex_init(&(handle->tlock_cb), NULL);
pthread_mutex_init(&(handle->tlock_log), NULL);
pthread_mutex_init(&(handle->tlock_task), NULL);
@@ -927,4 +927,28 @@ void _alpm_run_threaded(alpm_handle_t *handle,
#endif
}
+int SYMEXPORT alpm_option_set_thread_count(alpm_handle_t *handle,
+ unsigned int threads)
+{
+ CHECK_HANDLE(handle, return -1);
+#ifdef HAVE_PTHREAD
+ handle->threads = threads;
+#else
+ if(threads > 1) {
+ RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
+ }
+#endif
+ return 0;
+}
+
+unsigned int SYMEXPORT alpm_option_get_thread_count(alpm_handle_t *handle)
+{
+ CHECK_HANDLE(handle, return -1);
+#ifdef HAVE_PTHREAD
+ return handle->threads;
+#else
+ return 1;
+#endif
+}
+
/* vim: set noet: */