Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS.   //      // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.523 2002/09/20 12:08:01 anders Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.524 2002/10/23 19:07:01 mast Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>   #include <timers.h>      #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // --- Locale defines ---   //<locale-token project="roxen_start"> LOC_S </locale-token>
Roxen.git/server/base_server/configuration.pike:381:   void unregister_urls()   {    foreach( registered_urls + failed_urls, string url )    roxen.unregister_url(url, this_object());    registered_urls = ({});   }      private int num_modules = 0;   #ifdef THREADS   private Thread.Condition modules_stopped = Thread.Condition(); + private Thread.Mutex modules_stopped_mutex = Thread.Mutex();   #endif   private void safe_stop_module (RoxenModule mod, string desc)   {    if (mixed err = catch (mod && mod->stop && mod->stop()))    report_error ("While stopping " + desc + ": " + describe_backtrace (err)); -  if (!--num_modules) +    #ifdef THREADS -  modules_stopped->signal() +  Thread.MutexKey lock = modules_stopped_mutex->lock(); +  if (!--num_modules) +  modules_stopped->signal(); +  lock = 0; + #else +  --num_modules;   #endif -  ; +    }      void stop (void|int asynch)   //! Unregisters the urls and calls stop in all modules. Uses the   //! handler threads to lessen the impact if a module hangs. Doesn't   //! wait for all modules to finish if @[asynch] is nonzero.   {      #ifdef SNMP_AGENT    if(query("snmp_process") && objectp(roxen->snmpagent)) {
Roxen.git/server/base_server/configuration.pike:448:    if (mixed err = catch {    if (object m = log_function && function_object (log_function)) {    destruct (m);    allmods[m] = 0;    }    }) report_error ("While stopping the logger: " + describe_backtrace (err));    STOP_MODULES(indices (allmods), "unclassified module");   #undef STOP_MODULES       if (!asynch) { -  num_modules -= 17; -  if (num_modules) { +    #ifdef THREADS -  // Relying on the interpreter lock here. -  modules_stopped->wait(); +  Thread.MutexKey lock = modules_stopped_mutex->lock(); +  num_modules -= 17; +  if (num_modules) modules_stopped->wait (lock); +  lock = 0;   #else -  +  if (num_modules != 17)    error ("num_modules shouldn't be nonzero here when running nonthreaded.\n");   #endif    }   } - } +       string type_from_filename( string file, int|void to, string|void myext )   {    array(string)|string tmp;    if(!types_fun)    return to?({ "application/octet-stream", 0 }):"application/octet-stream";       string ext = lower_case(myext || Roxen.extension(file));       if(tmp = types_fun(ext))