Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.1033 2009/06/10 12:40:35 mast Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.1034 2009/06/11 07:48:12 mast Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:1275: Inside #if defined(THREADS)
   if (call_out) monitor->remove_call_out (call_out);   #endif    bg_process_running = 0;    handle (bg_process_queue);    throw (err);    }    bg_process_running = 0;   }   #endif    + protected function get_enqueue_func (function func, array args) + { +  return lambda() +  { +  bg_queue->write (({func, args})); +  if (!bg_process_running) +  handle (bg_process_queue); +  }; + } +    mixed background_run (int|float delay, function func, mixed... args)   //! Enqueue a task to run in the background in a way that makes as   //! little impact as possible on the incoming requests. No matter how   //! many tasks are queued to run in the background, only one is run at   //! a time. The tasks won't be starved regardless of server load,   //! though.   //!   //! The function @[func] will be enqueued after approximately @[delay]   //! seconds, to be called with the rest of the arguments as its   //! arguments.
Roxen.git/server/base_server/roxen.pike:1323: Inside #if defined(DEBUG_BACKGROUND_RUN)
   map (args, lambda (mixed arg)    {return sprintf ("%O", arg);}) * ", ",    bg_queue->size());   #endif      #ifdef THREADS    if (!hold_wakeup_cond)    // stop_handler_threads is running; ignore more work.    return 0;    -  function enqueue = lambda() -  { -  bg_queue->write (({func, args})); -  if (!bg_process_running) -  handle (bg_process_queue); -  }; -  +     mixed res;    if (delay) -  res = call_out (enqueue, delay); +  res = call_out (get_enqueue_func (func, args), delay);    else -  enqueue(); +  get_enqueue_func (func, args)();    -  enqueue = 0; // To avoid garbage. -  +     return res;   #else    // Can't do much better when we haven't got threads..    return call_out (func, delay, @args);   #endif   }      class BackgroundProcess   //! A class to do a task repeatedly in the background, in a way that   //! makes as little impact as possible on the incoming requests (using