]> git.sur5r.net Git - openldap/commitdiff
Rename syncrepl_rq to slapd_rq, move to daemon.c
authorHoward Chu <hyc@openldap.org>
Fri, 3 Dec 2004 16:49:23 +0000 (16:49 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 3 Dec 2004 16:49:23 +0000 (16:49 +0000)
servers/slapd/backend.c
servers/slapd/daemon.c
servers/slapd/overlays/pcache.c
servers/slapd/proto-slap.h
servers/slapd/syncrepl.c

index fb8fc0fe1bb129f53ee07ad88209b7e1726cb7d1..2b7f3eee5499c6317997952208fa5abcbff080d8 100644 (file)
@@ -261,9 +261,9 @@ int backend_startup(Backend *be)
                }
        }
 
-       ldap_pvt_thread_mutex_init( &syncrepl_rq.rq_mutex );
-       LDAP_STAILQ_INIT( &syncrepl_rq.task_list );
-       LDAP_STAILQ_INIT( &syncrepl_rq.run_list );
+       ldap_pvt_thread_mutex_init( &slapd_rq.rq_mutex );
+       LDAP_STAILQ_INIT( &slapd_rq.task_list );
+       LDAP_STAILQ_INIT( &slapd_rq.run_list );
 
        /* open each backend database */
        for( i = 0; i < nBackendDB; i++ ) {
@@ -295,10 +295,10 @@ int backend_startup(Backend *be)
                        LDAP_STAILQ_FOREACH( si, &backendDB[i].be_syncinfo, si_next ) {
                                si->si_be = &backendDB[i];
                                init_syncrepl( si );
-                               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
-                               ldap_pvt_runqueue_insert( &syncrepl_rq,
+                               ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+                               ldap_pvt_runqueue_insert( &slapd_rq,
                                                si->si_interval, do_syncrepl, (void *) si );
-                               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+                               ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
                        }
                }
        }
index 206c401777c1dcb3575aa1c8c4566d7ddc36d085..a4e3124ed9d713be777ddddecca43a706127a20b 100644 (file)
@@ -72,6 +72,7 @@ int slap_inet4or6 = AF_INET;
 time_t starttime;
 ber_socket_t dtblsize;
 slap_ssf_t local_ssf = LDAP_PVT_SASL_LOCAL_SSF;
+struct runqueue_s slapd_rq;
 
 Listener **slap_listeners = NULL;
 
@@ -1648,22 +1649,22 @@ slapd_daemon_task(
                else
                        tvp = NULL;
 
-               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
-               rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
+               ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+               rtask = ldap_pvt_runqueue_next_sched( &slapd_rq, &cat );
                while ( cat && cat->tv_sec && cat->tv_sec <= now ) {
-                       if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
-                               ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
+                       if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+                               ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
                        } else {
-                               ldap_pvt_runqueue_runtask( &syncrepl_rq, rtask );
-                               ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
-                               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+                               ldap_pvt_runqueue_runtask( &slapd_rq, rtask );
+                               ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
+                               ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
                                ldap_pvt_thread_pool_submit( &connection_pool,
                                                                                        rtask->routine, (void *) rtask );
-                               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+                               ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
                        }
-                       rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
+                       rtask = ldap_pvt_runqueue_next_sched( &slapd_rq, &cat );
                }
-               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+               ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
 
                if ( cat != NULL ) {
                        time_t diff = difftime( cat->tv_sec, now );
index 150dca2ad91a9ff186d78f41a5670e69d51f6299..35a344ef3a705cf8303529ed0aeaec3b01d0fa2e 100644 (file)
@@ -1123,12 +1123,12 @@ proxy_cache_response(
                         * wake it back up
                         */
                        if ( cm->cc_paused ) {
-                               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+                               ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
                                if ( cm->cc_paused ) {
                                        cm->cc_paused = 0;
-                                       ldap_pvt_runqueue_resched( &syncrepl_rq, cm->cc_arg, 0 );
+                                       ldap_pvt_runqueue_resched( &slapd_rq, cm->cc_arg, 0 );
                                }
-                               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+                               ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
                        }
                }
 
@@ -1466,15 +1466,15 @@ consistency_check(
                }
                ldap_pvt_thread_mutex_unlock(&cm->remove_mutex);
        }
-       ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
-       if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
-               ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
+       ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+       if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+               ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
        }
        /* If there were no queries, defer processing for a while */
        cm->cc_paused = pause;
-       ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, pause );
+       ldap_pvt_runqueue_resched( &slapd_rq, rtask, pause );
 
-       ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+       ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
        return NULL;
 }
 
@@ -1738,10 +1738,10 @@ proxy_cache_open(
 
        /* There is no runqueue in TOOL mode */
        if ( slapMode & SLAP_SERVER_MODE ) {
-               ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
-               ldap_pvt_runqueue_insert( &syncrepl_rq, cm->cc_period,
+               ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+               ldap_pvt_runqueue_insert( &slapd_rq, cm->cc_period,
                        consistency_check, on );
-               ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+               ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
 
                /* Cached database must have the rootdn */
                if ( BER_BVISNULL( &cm->db.be_rootndn )
index 06a6d469cd32a12f040e1ac88bd01562bd55ce05..bfcafdc10517dcb7c5d69cd759556ac9cd51a265 100644 (file)
@@ -513,6 +513,7 @@ LDAP_SLAPD_V (volatile sig_atomic_t) slapd_abrupt_shutdown;
 LDAP_SLAPD_V (volatile sig_atomic_t) slapd_shutdown;
 LDAP_SLAPD_V (int) slapd_register_slp;
 LDAP_SLAPD_V (slap_ssf_t) local_ssf;
+LDAP_SLAPD_V (struct runqueue_s) slapd_rq;
 
 /*
  * dn.c
@@ -1246,8 +1247,6 @@ LDAP_SLAPD_F (Filter *) str2filter_x LDAP_P(( Operation *op, const char *str ));
  * syncrepl.c
  */
 
-LDAP_SLAPD_V (struct runqueue_s) syncrepl_rq;
-
 LDAP_SLAPD_F (void) init_syncrepl LDAP_P((syncinfo_t *));
 LDAP_SLAPD_F (void*) do_syncrepl LDAP_P((void *, void *));
 LDAP_SLAPD_F (int) syncrepl_message_to_entry LDAP_P((
index 61abe661927c933aaf9a5581514b21523afc53fb..9524e274104750f8be7861bf559c4816bc8a6382 100644 (file)
@@ -50,8 +50,6 @@ static int null_callback( struct slap_op *, struct slap_rep * );
 
 static AttributeDescription *sync_descs[4];
 
-struct runqueue_s syncrepl_rq;
-
 void
 init_syncrepl(syncinfo_t *si)
 {
@@ -969,10 +967,10 @@ do_syncrepl(
         * 3) for Refresh and Success, reschedule to run
         * 4) for Persist and Success, reschedule to defer
         */
-       ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+       ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
 
-       if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
-               ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
+       if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+               ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
        }
 
        if ( dostop ) {
@@ -984,7 +982,7 @@ do_syncrepl(
                        defer = 0;
                }
                rtask->interval.tv_sec = si->si_interval;
-               ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, defer );
+               ldap_pvt_runqueue_resched( &slapd_rq, rtask, defer );
                if ( si->si_retrynum ) {
                        for ( i = 0; si->si_retrynum_init[i] != -2; i++ ) {
                                si->si_retrynum[i] = si->si_retrynum_init[i];
@@ -998,19 +996,19 @@ do_syncrepl(
                }
 
                if ( !si->si_retrynum || si->si_retrynum[i] == -2 ) {
-                       ldap_pvt_runqueue_remove( &syncrepl_rq, rtask );
+                       ldap_pvt_runqueue_remove( &slapd_rq, rtask );
                        LDAP_STAILQ_REMOVE( &be->be_syncinfo, si, syncinfo_s, si_next );
                        syncinfo_free( si );
                } else if ( si->si_retrynum[i] >= -1 ) {
                        if ( si->si_retrynum[i] > 0 )
                                si->si_retrynum[i]--;
                        rtask->interval.tv_sec = si->si_retryinterval[i];
-                       ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
+                       ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
                        slap_wake_listener();
                }
        }
        
-       ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+       ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
 
        return NULL;
 }