* We don't expect to use many...
*/
#define MAXKEYS 32
-#define MAXTHREADS 1024 /* must be a power of 2 */
+#define LDAP_MAXTHR 1024 /* must be a power of 2 */
static ldap_pvt_thread_t tid_zero;
static struct {
ldap_pvt_thread_t id;
ldap_int_thread_key_t *ctx;
-} thread_keys[MAXTHREADS];
+} thread_keys[LDAP_MAXTHR];
typedef struct ldap_int_thread_ctx_s {
pool->ltp_starting--;
/* assign this thread ID to a key slot; start
- * at the thread ID itself (mod MAXTHREADS) and
+ * at the thread ID itself (mod LDAP_MAXTHR) and
* look for an empty slot.
*/
TID_HASH(thr, hash);
- for (rc = hash & (MAXTHREADS-1);
+ for (rc = hash & (LDAP_MAXTHR-1);
!TID_EQ(thread_keys[rc].id, tid_zero);
- rc = (rc+1) & (MAXTHREADS-1));
+ rc = (rc+1) & (LDAP_MAXTHR-1));
thread_keys[rc].id = thr;
} else {
/* couldn't create thread. back out of
/* store pointer to our keys */
TID_HASH(tid, hash);
- for (i = hash & (MAXTHREADS-1); !TID_EQ(thread_keys[i].id, tid);
- i = (i+1) & (MAXTHREADS-1));
+ for (i = hash & (LDAP_MAXTHR-1); !TID_EQ(thread_keys[i].id, tid);
+ i = (i+1) & (LDAP_MAXTHR-1));
thread_keys[i].ctx = ltc_key;
keyslot = i;
tid = ldap_pvt_thread_self();
TID_HASH( tid, hash );
- for (i = hash & (MAXTHREADS-1); !TID_EQ(thread_keys[i].id, tid_zero) &&
- !TID_EQ(thread_keys[i].id, tid); i = (i+1) & (MAXTHREADS-1));
+ for (i = hash & (LDAP_MAXTHR-1); !TID_EQ(thread_keys[i].id, tid_zero) &&
+ !TID_EQ(thread_keys[i].id, tid); i = (i+1) & (LDAP_MAXTHR-1));
return thread_keys[i].ctx;
}