- Operation *op;
-
- ldap_pvt_thread_mutex_lock( &slap_op_mutex );
- if ((op = LDAP_STAILQ_FIRST( &slap_free_ops ))) {
- LDAP_STAILQ_REMOVE_HEAD( &slap_free_ops, o_next );
+ Operation *op = NULL;
+
+ if ( ctx ) {
+ void *otmp = NULL;
+ ldap_pvt_thread_pool_getkey( ctx, (void *)slap_op_free, &otmp, NULL );
+ if ( otmp ) {
+ op = otmp;
+ otmp = LDAP_STAILQ_NEXT( op, o_next );
+ ldap_pvt_thread_pool_setkey( ctx, (void *)slap_op_free,
+ otmp, slap_op_q_destroy, NULL, NULL );
+ }