diff options
author | 2 <NotZed@Ximian.com> | 2001-10-13 07:08:32 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-13 07:08:32 +0800 |
commit | fa32b99837c0cc6aee42ac8d68588076a4f88efb (patch) | |
tree | 441af85766d31c6e911f0775b37d1548e0b1a59b /libibex/ibex_block.c | |
parent | dad441ba034c9c3b336a1af5b67c7e41f9bd9ad3 (diff) | |
download | gsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.tar gsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.tar.gz gsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.tar.bz2 gsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.tar.lz gsoc2013-evolution-fa32b99837c0cc6aee42ac8d68588076a4f88efb.tar.xz 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
Diffstat (limited to 'libibex/ibex_block.c')
-rw-r--r-- | libibex/ibex_block.c | 18 |
1 files changed, 17 insertions, 1 deletions
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) { |