Branch: Tag:

2009-06-11

2009-06-11 07:48:12 by Martin Stjernholm <mast@lysator.liu.se>

Workaround for trampoline garbage in background_run with pike 7.8.

Rev: server/base_server/roxen.pike:1.1034

6:   // 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   //!
1282:   }   #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
1330: Inside #if defined(THREADS)
   // 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..