diff --git a/contrib/slapd-modules/smbk5pwd/smbk5pwd.c b/contrib/slapd-modules/smbk5pwd/smbk5pwd.c
index 545a00cc7200513f117741fc00fd07f0c16d758e..f6072ee14e5d018e203e1200f0bcb96e35c8672f 100644
--- a/contrib/slapd-modules/smbk5pwd/smbk5pwd.c
+++ b/contrib/slapd-modules/smbk5pwd/smbk5pwd.c
@@ -215,7 +215,7 @@ static int smbk5pwd_op_cleanup(
 
 	/* clear out the current key */
 	ldap_pvt_thread_pool_setkey( op->o_threadctx, smbk5pwd_op_cleanup,
-		NULL, NULL, NULL, NULL );
+		NULL, 0, NULL, NULL );
 
 	/* free the callback */
 	cb = op->o_callback;
@@ -235,7 +235,7 @@ static int smbk5pwd_op_bind(
 	if ( op->oq_bind.rb_method == LDAP_AUTH_SIMPLE ) {
 		slap_callback *cb;
 		ldap_pvt_thread_pool_setkey( op->o_threadctx,
-			smbk5pwd_op_cleanup, op, NULL, NULL, NULL );
+			smbk5pwd_op_cleanup, op, 0, NULL, NULL );
 		cb = op->o_tmpcalloc( 1, sizeof(slap_callback), op->o_tmpmemctx );
 		cb->sc_cleanup = smbk5pwd_op_cleanup;
 		cb->sc_next = op->o_callback;
diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c
index 70c1f8bf744abf10e23424e37e74ab290f419c07..3156667d40a8947dc8855fd02557992abc67c330 100644
--- a/servers/slapd/back-bdb/cache.c
+++ b/servers/slapd/back-bdb/cache.c
@@ -1449,7 +1449,7 @@ bdb_locker_flush( DB_ENV *env )
 	void *ctx = ldap_pvt_thread_pool_context();
 
 	if ( !ldap_pvt_thread_pool_getkey( ctx, env, &data, NULL ) ) {
-		ldap_pvt_thread_pool_setkey( ctx, env, NULL, NULL, NULL, NULL );
+		ldap_pvt_thread_pool_setkey( ctx, env, NULL, 0, NULL, NULL );
 		bdb_locker_id_free( env, data );
 	}
 }
diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c
index d768084474b7e6066f9204bbff9232ec18fc33e2..abe130f5502f1319867ed83137efb3a7278b09a4 100644
--- a/servers/slapd/back-bdb/search.c
+++ b/servers/slapd/back-bdb/search.c
@@ -998,7 +998,7 @@ static void *search_stack( Operation *op )
 	void *ret = NULL;
 
 	if ( op->o_threadctx ) {
-		ldap_pvt_thread_pool_getkey( op->o_threadctx, search_stack,
+		ldap_pvt_thread_pool_getkey( op->o_threadctx, (void *)search_stack,
 			&ret, NULL );
 	} else {
 		ret = bdb->bi_search_stack;
@@ -1008,7 +1008,7 @@ static void *search_stack( Operation *op )
 		ret = ch_malloc( bdb->bi_search_stack_depth * BDB_IDL_UM_SIZE
 			* sizeof( ID ) );
 		if ( op->o_threadctx ) {
-			ldap_pvt_thread_pool_setkey( op->o_threadctx, search_stack,
+			ldap_pvt_thread_pool_setkey( op->o_threadctx, (void *)search_stack,
 				ret, search_stack_free, NULL, NULL );
 		} else {
 			bdb->bi_search_stack = ret;
diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c
index 55a2f32e1c72e708aa6394a74d9d63bd301038ea..7d6884a848d82f2d34343de09b677c7c77b14018 100644
--- a/servers/slapd/backend.c
+++ b/servers/slapd/backend.c
@@ -822,15 +822,15 @@ be_rootdn_bind( Operation *op, SlapReply *rs )
 	}
 
 #ifdef SLAPD_SPASSWD
-	ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind,
-		op->o_conn->c_sasl_authctx, NULL, &old_authctx, NULL );
+	ldap_pvt_thread_pool_setkey( op->o_threadctx, (void *)slap_sasl_bind,
+		op->o_conn->c_sasl_authctx, 0, &old_authctx, NULL );
 #endif
 
 	rc = lutil_passwd( &op->o_bd->be_rootpw, &op->orb_cred, NULL, NULL );
 
 #ifdef SLAPD_SPASSWD
-	ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind,
-		old_authctx, NULL, NULL, NULL );
+	ldap_pvt_thread_pool_setkey( op->o_threadctx, (void *)slap_sasl_bind,
+		old_authctx, 0, NULL, NULL );
 #endif
 
 	rc = ( rc == 0 ? LDAP_SUCCESS : LDAP_INVALID_CREDENTIALS );
diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c
index ab084319e4f801c040ed4ff0472c1522cf7d36a5..a42e7ace3faba3c2d7d43cd86460f06b72cd11ad 100644
--- a/servers/slapd/connection.c
+++ b/servers/slapd/connection.c
@@ -971,11 +971,12 @@ conn_counter_init( Operation *op, void *ctx )
 	slap_counters_t *sc;
 	void *vsc = NULL;
 
-	if ( ldap_pvt_thread_pool_getkey( ctx, conn_counter_init, &vsc, NULL ) || !vsc ) {
+	if ( ldap_pvt_thread_pool_getkey(
+			ctx, (void *)conn_counter_init, &vsc, NULL ) || !vsc ) {
 		vsc = ch_malloc( sizeof( slap_counters_t ));
 		sc = vsc;
 		slap_counters_init( sc );
-		ldap_pvt_thread_pool_setkey( ctx, conn_counter_init, vsc,
+		ldap_pvt_thread_pool_setkey( ctx, (void*)conn_counter_init, vsc,
 			conn_counter_destroy, NULL, NULL );
 
 		ldap_pvt_thread_mutex_lock( &slap_counters.sc_mutex );
@@ -1946,14 +1947,14 @@ connection_fake_init2(
 		void *ebx = NULL;
 
 		/* Use thread keys to make sure these eventually get cleaned up */
-		if ( ldap_pvt_thread_pool_getkey( ctx, connection_fake_init, &ebx,
-			NULL )) {
+		if ( ldap_pvt_thread_pool_getkey( ctx, (void *)connection_fake_init,
+				&ebx, NULL )) {
 			eb = ch_malloc( sizeof( *eb ));
 			slapi_int_create_object_extensions( SLAPI_X_EXT_CONNECTION, conn );
 			slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
 			eb->eb_conn = conn->c_extensions;
 			eb->eb_op = op->o_hdr->oh_extensions;
-			ldap_pvt_thread_pool_setkey( ctx, connection_fake_init,
+			ldap_pvt_thread_pool_setkey( ctx, (void *)connection_fake_init,
 				eb, connection_fake_destroy, NULL, NULL );
 		} else {
 			eb = ebx;
diff --git a/servers/slapd/overlays/memberof.c b/servers/slapd/overlays/memberof.c
index 8915661ef62c33d821e1480db2c4ccb41bb809d5..09edce82b7f6f662703849bf90c0132c9c61f8a2 100644
--- a/servers/slapd/overlays/memberof.c
+++ b/servers/slapd/overlays/memberof.c
@@ -205,7 +205,7 @@ memberof_saved_member_get( Operation *op, void *keyp )
 
 	} else {
 		ldap_pvt_thread_pool_setkey( op->o_threadctx,
-				key, NULL, NULL, &vals, NULL );
+				key, NULL, 0, &vals, NULL );
 	}
 
 	return vals;
diff --git a/servers/slapd/passwd.c b/servers/slapd/passwd.c
index 8b1c299e3c69c7704b60d1d4d66db5c5d3208b39..18d0bd2142fcd0fb7f7a0f3068c84ca568715a99 100644
--- a/servers/slapd/passwd.c
+++ b/servers/slapd/passwd.c
@@ -507,8 +507,8 @@ slap_passwd_check(
 #ifdef SLAPD_SPASSWD
 	void		*old_authctx = NULL;
 
-	ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind,
-		op->o_conn->c_sasl_authctx, NULL, &old_authctx, NULL );
+	ldap_pvt_thread_pool_setkey( op->o_threadctx, (void *)slap_sasl_bind,
+		op->o_conn->c_sasl_authctx, 0, &old_authctx, NULL );
 #endif
 
 	for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
@@ -526,8 +526,8 @@ slap_passwd_check(
 	}
 
 #ifdef SLAPD_SPASSWD
-	ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind,
-		old_authctx, NULL, NULL, NULL );
+	ldap_pvt_thread_pool_setkey( op->o_threadctx, (void *)slap_sasl_bind,
+		old_authctx, 0, NULL, NULL );
 #endif
 
 	return result;
diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c
index 95b2394ed4c8fe4b77426c31100e623122d7e81c..f794a99f8790b04eaeab111621e110cb308ec7b6 100644
--- a/servers/slapd/sasl.c
+++ b/servers/slapd/sasl.c
@@ -829,7 +829,7 @@ static int chk_sasl(
 	rtn = LUTIL_PASSWD_ERR;
 
 	ctx = ldap_pvt_thread_pool_context();
-	ldap_pvt_thread_pool_getkey( ctx, slap_sasl_bind, &sconn, NULL );
+	ldap_pvt_thread_pool_getkey( ctx, (void *)slap_sasl_bind, &sconn, NULL );
 
 	if( sconn != NULL ) {
 		int sc;
diff --git a/servers/slapd/sl_malloc.c b/servers/slapd/sl_malloc.c
index 16d6d8119207900a4c6f7726edde8cf082c83a28..74e24e21e89d7042fef38a4325bee89fa6b04fb0 100644
--- a/servers/slapd/sl_malloc.c
+++ b/servers/slapd/sl_malloc.c
@@ -246,7 +246,8 @@ slap_sl_mem_detach(
 	slheap = NULL;
 #else
 	/* separate from context */
-	ldap_pvt_thread_pool_setkey( ctx, (void *)slap_sl_mem_init, NULL, NULL, NULL, NULL );
+	ldap_pvt_thread_pool_setkey( ctx, (void *)slap_sl_mem_init,
+		NULL, 0, NULL, NULL );
 #endif
 }