Changeset 1568

Show
Ignore:
Timestamp:
06/17/08 20:22:44 (3 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1567 r1568  
    112008-06-17  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/server.c (stop_threads): It must stop all the threads 
     4        before flushing the log files. 
     5 
     6        * cherokee/common-internal.h (CHEROKEE_THREAD_JOIN): New macro. 
    27 
    38        * cherokee/server.c (cherokee_server_print_build_info), 
  • cherokee/trunk/cherokee/common-internal.h

    r1282 r1568  
    8686# define CHEROKEE_MUTEX_T(n)          pthread_mutex_t n 
    8787# define CHEROKEE_RWLOCK_T(n)         pthread_rwlock_t n 
     88# define CHEROKEE_THREAD_JOIN(t)      pthread_join(t,NULL) 
    8889 
    8990# define CHEROKEE_MUTEX_LOCK(m)       pthread_mutex_lock(m) 
     
    103104# define CHEROKEE_MUTEX_T(n)           
    104105# define CHEROKEE_RWLOCK_T(n)          
     106# define CHEROKEE_THREAD_JOIN(t) 
    105107 
    106108# define CHEROKEE_MUTEX_LOCK(m) 
  • cherokee/trunk/cherokee/server.c

    r1567 r1568  
    11511151 
    11521152static void 
     1153stop_threads (cherokee_server_t *srv) 
     1154{ 
     1155        cherokee_list_t *i; 
     1156 
     1157        list_for_each (i, &srv->thread_list) { 
     1158                THREAD(i)->exit = true; 
     1159        } 
     1160 
     1161        list_for_each (i, &srv->thread_list) { 
     1162                CHEROKEE_THREAD_JOIN (THREAD(i)->thread); 
     1163        } 
     1164} 
     1165 
     1166 
     1167static void 
    11531168flush_logs (cherokee_server_t *srv) 
    11541169{ 
    11551170        cherokee_list_t   *i; 
    11561171        cherokee_logger_t *logger; 
    1157  
    1158         list_for_each (i, &srv->vservers) { 
    1159                 logger = VSERVER_LOGGER(i); 
    1160  
    1161                 if (logger) 
    1162                         cherokee_logger_flush (VSERVER_LOGGER(i)); 
    1163         } 
    1164  
     1172         
     1173        /* Main virtual server 
     1174         */ 
    11651175        logger = VSERVER_LOGGER(srv->vserver_default); 
    11661176        if (logger)  
    11671177                cherokee_logger_flush (VSERVER_LOGGER(srv->vserver_default)); 
     1178 
     1179        /* Rest of the virtual servers 
     1180         */ 
     1181        list_for_each (i, &srv->vservers) { 
     1182                logger = VSERVER_LOGGER(i); 
     1183                if (logger) 
     1184                        cherokee_logger_flush (VSERVER_LOGGER(i)); 
     1185        } 
    11681186} 
    11691187 
     
    13541372#endif 
    13551373 
    1356         /* Wanna reinit or exit ? 
    1357          */ 
    1358         if (likely ((srv->wanna_reinit | srv->wanna_exit) == 0)) 
    1359                 return ret_eagain; 
    1360  
    13611374        /* Wanna reinit ? 
    13621375         */ 
    1363         if (srv->wanna_reinit) { 
     1376        if (unlikely (srv->wanna_reinit)) { 
    13641377                ret = cherokee_server_reinit (srv); 
    13651378 
     
    13741387        /* Wanna exit ? 
    13751388         */ 
    1376         if (srv->wanna_exit) { 
     1389        if (unlikely (srv->wanna_exit)) { 
     1390                stop_threads (srv); 
    13771391                flush_logs (srv); 
    13781392                return ret_ok;