From b4c3c0fa9b3fa9ce8ad64784ccf183e16b084b8c Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 15 Aug 2001 04:57:51 +0000 Subject: New function to limit use of fd's. Mark an ibex file in use, re-open if 2001-08-15 Not Zed * ibex_block.c (ibex_use): New function to limit use of fd's. Mark an ibex file in use, re-open if necessary, and close off another (lru) if necessary. (ibex_unuse): Mark an ibex as not in use. (ibex_open): Delay opening of the actual block file till later, and add the ibex to a global list. (ibex_save): Use/unuse around operations. (close_backend): Zero out blocks when closed. (ibex_close): Remove the ibex from the global list before closing it down. (ibex_index_buffer, ibex_find, ibex_unindex, ibex_find_name): Use/unuse around ops. svn path=/trunk/; revision=12042 --- libibex/ibex_internal.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libibex/ibex_internal.h') diff --git a/libibex/ibex_internal.h b/libibex/ibex_internal.h index d8e5e28296..bb15ebc1f7 100644 --- a/libibex/ibex_internal.h +++ b/libibex/ibex_internal.h @@ -27,6 +27,11 @@ #include "wordindex.h" struct ibex { + struct ibex *next; /* for list of open ibex's */ + struct ibex *prev; + + int usecount; + char *name; int flags; int mode; @@ -41,6 +46,8 @@ struct ibex { }; +#define IBEX_OPEN_THRESHOLD (5) + #ifdef ENABLE_THREADS /*#define IBEX_LOCK(ib) (printf(__FILE__ "%d: %s: locking ibex\n", __LINE__, __FUNCTION__), g_mutex_lock(ib->lock)) #define IBEX_UNLOCK(ib) (printf(__FILE__ "%d: %s: unlocking ibex\n", __LINE__, __FUNCTION__), g_mutex_unlock(ib->lock))*/ -- cgit v1.2.3