File tree Expand file tree Collapse file tree 1 file changed +21
-13
lines changed
Expand file tree Collapse file tree 1 file changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -956,21 +956,29 @@ bool webserver::is_running()
956956
957957bool webserver::stop ()
958958{
959- pthread_mutex_lock (&mutexwait);
960- this ->running = false ;
961- pthread_cond_signal (&mutexcond);
962- pthread_mutex_unlock (&mutexwait);
963- for (unsigned int i = 0 ; i < threads.size (); ++i)
959+ if (this ->running )
964960 {
965- int t_res;
966- pthread_join (threads[i], (void **) &t_res);
961+ pthread_mutex_lock (&mutexwait);
962+ this ->running = false ;
963+ pthread_cond_signal (&mutexcond);
964+ pthread_mutex_unlock (&mutexwait);
965+ for (unsigned int i = 0 ; i < threads.size (); ++i)
966+ {
967+ void * t_res;
968+ pthread_join (threads[i], &t_res);
969+ free (t_res);
970+ }
971+ threads.clear ();
972+ typedef vector<details::daemon_item*>::const_iterator daemon_item_it;
973+ for (daemon_item_it it = daemons.begin (); it != daemons.end (); ++it)
974+ delete *it;
975+ daemons.clear ();
976+ return true ;
977+ }
978+ else
979+ {
980+ return false ;
967981 }
968- threads.clear ();
969- typedef vector<details::daemon_item*>::const_iterator daemon_item_it;
970- for (daemon_item_it it = daemons.begin (); it != daemons.end (); ++it)
971- delete *it;
972- daemons.clear ();
973- return true ;
974982}
975983
976984void webserver::unregister_resource (const string& resource)
You can’t perform that action at this time.
0 commit comments