1 /* operation.c - routines to deal with pending ldap operations */
12 extern time_t currenttime;
13 extern pthread_mutex_t currenttime_mutex;
16 op_free( Operation *op )
18 if ( op->o_ber != NULL )
19 ber_free( op->o_ber, 1 );
20 if ( op->o_dn != NULL ) {
23 /* pthread_mutex_destroy( &op->o_abandonmutex ); */
40 for ( tmp = olist; *tmp != NULL; tmp = &(*tmp)->o_next )
43 *tmp = (Operation *) calloc( 1, sizeof(Operation) );
44 pthread_mutex_init( &(*tmp)->o_abandonmutex,
45 pthread_mutexattr_default );
47 (*tmp)->o_msgid = msgid;
49 (*tmp)->o_abandon = 0;
50 (*tmp)->o_dn = strdup( dn != NULL ? dn : "" );
51 pthread_mutex_lock( ¤ttime_mutex );
52 (*tmp)->o_time = currenttime;
53 pthread_mutex_unlock( ¤ttime_mutex );
55 (*tmp)->o_connid = connid;
56 (*tmp)->o_next = NULL;
62 op_delete( Operation **olist, Operation *op )
66 for ( tmp = olist; *tmp != NULL && *tmp != op; tmp = &(*tmp)->o_next )
70 Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %d\n",
75 *tmp = (*tmp)->o_next;