]> git.sur5r.net Git - openldap/commitdiff
ITS#1733 eliminate o_abandonmutex
authorHoward Chu <hyc@openldap.org>
Thu, 11 Apr 2002 08:03:40 +0000 (08:03 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 11 Apr 2002 08:03:40 +0000 (08:03 +0000)
20 files changed:
servers/slapd/abandon.c
servers/slapd/back-bdb/search.c
servers/slapd/back-ldbm/modify.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-meta/search.c
servers/slapd/back-monitor/log.c
servers/slapd/back-passwd/search.c
servers/slapd/back-shell/abandon.c
servers/slapd/back-sql/search.c
servers/slapd/backend.c
servers/slapd/backglue.c
servers/slapd/connection.c
servers/slapd/daemon.c
servers/slapd/main.c
servers/slapd/operation.c
servers/slapd/referral.c
servers/slapd/result.c
servers/slapd/saslauthz.c
servers/slapd/slap.h

index cc3cc8cc9eb31372ca107d777e7e6114e3688743..b092d124f338f2c1d2713d7a0fe672af46949edd 100644 (file)
@@ -92,9 +92,7 @@ do_abandon(
 
        LDAP_STAILQ_FOREACH( o, &conn->c_ops, o_next ) {
                if ( o->o_msgid == id ) {
-                       ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
                        o->o_abandon = 1;
-                       ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
                        goto done;
                }
        }
index af5048a4c2c012d34bc28be04ec0f2ab61ae14cf..ed11d5f03c0f2a045c8778b0533d82d0f5ebc9be 100644 (file)
@@ -44,7 +44,6 @@ bdb_search(
        int             attrsonly )
 {
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
-       int              abandon;
        int             rc;
        const char *text = NULL;
        time_t          stoptime;
@@ -299,11 +298,7 @@ bdb_search(
                int             scopeok = 0;
 
                /* check for abandon */
-               ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
-               abandon = op->o_abandon;
-               ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
-
-               if ( abandon ) {
+               if ( op->o_abandon ) {
                        rc = 0;
                        goto done;
                }
index 6948d2ffd8d088e8e9a56fab030b90d9e2f0a88d..2dfb9be680593217a56ba282277498279f4fd17e 100644 (file)
@@ -207,10 +207,7 @@ int ldbm_modify_internal(
        }
 
        /* check for abandon */
-       ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
-       rc = op->o_abandon;
-       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
-       if ( rc ) {
+       if ( op->o_abandon ) {
                rc = SLAPD_ABANDON;
                goto exit;
        }
index eb5ec10b2e93b49439a879277101107743e8d0cc..59aee6894c5d6a2318369dc978ef29c46b4a4701 100644 (file)
@@ -468,13 +468,10 @@ ldbm_back_modrdn(
 #endif
 
        /* check for abandon */
-       ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
        if ( op->o_abandon ) {
-               ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
                goto return_results;
        }
 
-       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
        if ( ( rc_id = dn2id ( be, &new_ndn, &id ) ) || id != NOID ) {
                /* if (rc_id) something bad happened to ldbm cache */
                send_ldap_result( conn, op, 
@@ -708,12 +705,9 @@ ldbm_back_modrdn(
 
        
        /* check for abandon */
-       ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
        if ( op->o_abandon ) {
-               ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
                goto return_results;
        }
-       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
 
        /* delete old one */
        if ( dn2id_delete( be, &e->e_nname, e->e_id ) != 0 ) {
index c61b921ac6e01982298ec4986d666f1b6171c1eb..a82ffe7f90ba8fa805985bee8c543d56a13b9e40 100644 (file)
@@ -295,16 +295,11 @@ searchit:
                int scopeok = 0;
 
                /* check for abandon */
-               ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
-
                if ( op->o_abandon ) {
-                       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
                        rc = 0;
                        goto done;
                }
 
-               ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
-
                /* check time limit */
                if ( tlimit != -1 && slap_get_time() > stoptime ) {
                        send_search_result( conn, op, LDAP_TIMELIMIT_EXCEEDED,
index 98754a69e357904698ba23c7dfdffe61716113ac..49edc7a8ad250e1109a268b6c2b5233406745550 100644 (file)
@@ -406,9 +406,7 @@ meta_back_search(
                int ab, gotit = 0;
 
                /* check for abandon */
-               ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
                ab = op->o_abandon;
-               ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
 
                for ( i = 0, lsc = lc->conns; lsc[ 0 ] != NULL; lsc++, i++ ) {
                        if ( lsc[ 0 ]->candidate != META_CANDIDATE ) {
index 2a74e1354af2db6c2da46b519bbbf214e9fa5b48..ab379e9222d8c8bec6d3a11ff7d6e18dba8bd297 100644 (file)
@@ -196,9 +196,7 @@ monitor_subsys_log_modify(
 
 #if 0  /* need op */
                /* check for abandon */
-               ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
                if ( op->o_abandon ) {
-                       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
                        rc = SLAPD_ABANDON;
 
                        goto cleanup;
index e88e05030be766842d2a882b5f11fe1fd8db278b..2cdeb4c9cf1671c2b1566d3a70f98805ebee3e1f 100644 (file)
@@ -132,13 +132,10 @@ passwd_back_search(
 
                        for ( pw = getpwent(); pw != NULL; pw = getpwent() ) {
                                /* check for abandon */
-                               ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
                                if ( op->o_abandon ) {
-                                       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
                                        endpwent();
                                        return( -1 );
                                }
-                               ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
 
                                /* check time limit */
                                if ( slap_get_time() > stoptime ) {
index dd552a7174f3910f5fcbd7159c5377cabc5c87f6..2eccb51f1272b79ef84b50a079454cff120c95e9 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <stdio.h>
 
-#include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 
index cf68f8c1289acdc08c82a8f23f9f18fb2342ecc7..2dca484832374d894fbdfefd902a7cf738688a0f 100644 (file)
@@ -584,13 +584,10 @@ int backsql_search(BackendDB *be,Connection *conn,Operation *op,
  for(eid=srch_info.id_list;eid!=NULL;eid=eid->next)
   {
    /* check for abandon */
-   ldap_pvt_thread_mutex_lock(&op->o_abandonmutex);
    if (op->o_abandon)
     {
-     ldap_pvt_thread_mutex_unlock(&op->o_abandonmutex);
      break;
     }
-   ldap_pvt_thread_mutex_unlock(&op->o_abandonmutex);
 
    /* check time limit */
    if ( tlimit != -1 && slap_get_time() > stoptime)
index b010528dde9aebec8b0627dba6a49f9a0d223728..1fbeecde211773ba4f603e6ec1afe732439d09e4 100644 (file)
@@ -993,12 +993,8 @@ backend_group(
 )
 {
        GroupAssertion *g;
-       int i;
 
-       ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
-       i = op->o_abandon;
-       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
-       if (i) return SLAPD_ABANDON;
+       if ( op->o_abandon ) return SLAPD_ABANDON;
 
        if ( !dn_match( &target->e_nname, gr_ndn ) ) {
                /* we won't attempt to send it to a different backend */
index 9b1a445325d9307872e74e085987e287c7f77cf1..0eccc8b8ac9cf75071e081c456cd9a20f37be7ec 100644 (file)
@@ -349,14 +349,11 @@ glue_back_search (
                                        break;
                                }
                        }
+                       rc = 0;
                        /*
                         * check for abandon 
                         */
-                       ldap_pvt_thread_mutex_lock (&op->o_abandonmutex);
-                       rc = op->o_abandon;
-                       ldap_pvt_thread_mutex_unlock (&op->o_abandonmutex);
-                       if (rc) {
-                               rc = 0;
+                       if (op->o_abandon) {
                                goto done;
                        }
                        be = gi->n[i].be;
index 6e1219ddbaa15252870c36725e38ff1b518b053f..41828b6aca36d61430dd6c59c896e6edd6401a4a 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <ac/socket.h>
 #include <ac/errno.h>
-#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/time.h>
 #include <ac/unistd.h>
@@ -740,9 +739,7 @@ static void connection_abandon( Connection *c )
        Operation *o;
 
        LDAP_STAILQ_FOREACH(o, &c->c_ops, o_next) {
-               ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
                o->o_abandon = 1;
-               ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
        }
 
        /* remove pending operations */
index 5276f7fdddf713d65e226f794219a60349ac95ce..2ab0fa769ff440d01a274ad3dab7c4eb701dc4e1 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <ac/ctype.h>
 #include <ac/errno.h>
-#include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
index 686d9cfa35bae2df874c34bafc6232b3c8ab9899..fa1bb4916d5b4800840461b1dd2c214628f4278b 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <stdio.h>
 
-#include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
index d4473c26433a7489a6f2da66ed21a2b7b8d09b50..49c1a7b58c50815c7506a5fef15d79119f1d3c93 100644 (file)
@@ -36,8 +36,6 @@ slap_op_free( Operation *op )
                ldap_controls_free( op->o_ctrls );
        }
 
-       ldap_pvt_thread_mutex_destroy( &op->o_abandonmutex );
-
        free( (char *) op );
 }
 
@@ -53,8 +51,6 @@ slap_op_alloc(
 
        op = (Operation *) ch_calloc( 1, sizeof(Operation) );
 
-       ldap_pvt_thread_mutex_init( &op->o_abandonmutex );
-
        op->o_ber = ber;
        op->o_msgid = msgid;
        op->o_tag = tag;
index 1293c32a354951aa2c58b5b4b88b9f7a85925ad5..d3caa3ffd4a0c39c767160ae4fc48ea1f04d1a92 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <ac/socket.h>
 #include <ac/errno.h>
-#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/ctype.h>
 #include <ac/time.h>
index c48c9a5301b0b5110ab70f675553a9badd5e107d..8c96ff0239683f6f1b0d69de9297b65ec2e695af 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <ac/socket.h>
 #include <ac/errno.h>
-#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/ctype.h>
 #include <ac/time.h>
index 5b78f4dd373c8b23e8fc1830870670acb3c9bea8..2f9ee9b74a12e514870cf7f731254c7ce675bb96 100644 (file)
@@ -394,7 +394,6 @@ void slap_sasl2dn( struct berval *saslname, struct berval *dn )
                goto FINISHED;
        suffix_alias( be, &searchbase );
 
-       ldap_pvt_thread_mutex_init( &op.o_abandonmutex );
        op.o_tag = LDAP_REQ_SEARCH;
        op.o_protocol = LDAP_VERSION3;
        op.o_ndn = *saslname;
@@ -405,8 +404,6 @@ void slap_sasl2dn( struct berval *saslname, struct berval *dn )
           scope, /*deref=*/1, /*sizelimit=*/1, /*time=*/0, filter, /*fstr=*/NULL,
           /*attrs=*/NULL, /*attrsonly=*/0 );
        
-       ldap_pvt_thread_mutex_destroy( &op.o_abandonmutex );
-
 FINISHED:
        if( searchbase.bv_len ) ch_free( searchbase.bv_val );
        if( filter ) filter_free( filter );
@@ -513,7 +510,6 @@ int slap_sasl_match( struct berval *rule, struct berval *assertDN, struct berval
        sm.match = 0;
        cb.sc_private = &sm;
 
-       ldap_pvt_thread_mutex_init( &op.o_abandonmutex );
        op.o_tag = LDAP_REQ_SEARCH;
        op.o_protocol = LDAP_VERSION3;
        op.o_ndn = *authc;
@@ -524,8 +520,6 @@ int slap_sasl_match( struct berval *rule, struct berval *assertDN, struct berval
           scope, /*deref=*/1, /*sizelimit=*/0, /*time=*/0, filter, /*fstr=*/NULL,
           /*attrs=*/NULL, /*attrsonly=*/0 );
 
-       ldap_pvt_thread_mutex_destroy( &op.o_abandonmutex );
-
        if (sm.match)
                rc = LDAP_SUCCESS;
        else
index c965f984d330fd9f1a44ced96dccf3d8eb24f505..ce76b301bc8e142dd3bfd719977ee99589c94c02 100644 (file)
@@ -16,6 +16,7 @@
 #include <sys/types.h>
 #include <ac/syslog.h>
 #include <ac/regex.h>
+#include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/time.h>
 #include <ac/param.h>
@@ -1442,8 +1443,7 @@ typedef struct slap_op {
 
        ldap_pvt_thread_t       o_tid;  /* thread handling this op */
 
-       ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
-       char o_abandon; /* abandon flag */
+       volatile sig_atomic_t o_abandon;        /* abandon flag */
 
 #define SLAP_NO_CONTROL 0
 #define SLAP_NONCRITICAL_CONTROL 1