aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author2 <NotZed@Ximian.com>2001-10-13 07:08:32 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-13 07:08:32 +0800
commitfa32b99837c0cc6aee42ac8d68588076a4f88efb (patch)
tree441af85766d31c6e911f0775b37d1548e0b1a59b
parentdad441ba034c9c3b336a1af5b67c7e41f9bd9ad3 (diff)
downloadgsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.tar.gz
gsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.tar.zst
gsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.zip
Added environmental variable IBEX_OPEN_THRESHOLD which limits the maximum
2001-10-12 <NotZed@Ximian.com> * ibex_block.c (ibex_use): Added environmental variable IBEX_OPEN_THRESHOLD which limits the maximum number of open ibex's that can be active at any time. The smallest this can be set to is the default of 5. svn path=/trunk/; revision=13642
-rw-r--r--libibex/ChangeLog7
-rw-r--r--libibex/ibex_block.c18
2 files changed, 24 insertions, 1 deletions
diff --git a/libibex/ChangeLog b/libibex/ChangeLog
index 2f5a1e27af..b91a747552 100644
--- a/libibex/ChangeLog
+++ b/libibex/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-12 <NotZed@Ximian.com>
+
+ * ibex_block.c (ibex_use): Added environmental variable
+ IBEX_OPEN_THRESHOLD which limits the maximum number of open ibex's
+ that can be active at any time. The smallest this can be set to
+ is the default of 5.
+
2001-09-20 <NotZed@Ximian.com>
* ibex_block.c: Turn off the o(x) debug set, & include alloca.h &
diff --git a/libibex/ibex_block.c b/libibex/ibex_block.c
index 112ae140e2..7ce4e7934b 100644
--- a/libibex/ibex_block.c
+++ b/libibex/ibex_block.c
@@ -10,6 +10,7 @@
#include <ctype.h>
#include <string.h>
#include <errno.h>
+#include <stdlib.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
@@ -24,6 +25,8 @@ static void ibex_reset(ibex *ib);
static int close_backend(ibex *ib);
static struct _list ibex_list = { (struct _listnode *)&ibex_list.tail, 0, (struct _listnode *)&ibex_list.head };
+static int ibex_open_init = 0;
+static int ibex_open_threshold = IBEX_OPEN_THRESHOLD;
#ifdef ENABLE_THREADS
#include <pthread.h>
@@ -70,9 +73,22 @@ static void ibex_use(ibex *ib)
IBEX_UNLOCK(ib);
+ /* check env variable override for open threshold */
+ if (!ibex_open_init) {
+ char *limit;
+
+ ibex_open_init = TRUE;
+ limit = getenv("IBEX_OPEN_THRESHOLD");
+ if (limit) {
+ ibex_open_threshold = atoi(limit);
+ if (ibex_open_threshold < IBEX_OPEN_THRESHOLD)
+ ibex_open_threshold = IBEX_OPEN_THRESHOLD;
+ }
+ }
+
/* check for other ibex's we can close now to not over-use fd's.
we can't do this first for locking issues */
- if (ibex_opened > IBEX_OPEN_THRESHOLD) {
+ if (ibex_opened > ibex_open_threshold) {
wb = (ibex *)ibex_list.head;
wn = wb->next;
while (wn) {