2010-06-03
2010-06-03 12:07:25 by Fredrik Noring <noring@nocrew.org>
-
f6ef158cb0d720d9edcc2f2ac0c6fd8fbaee4b71
(31 lines)
(+18/-13)
[
Show
| Annotate
]
Branch: 5.2
Improved background_run debug capabilities, esp. using call_out_info()
Rev: server/base_server/roxen.pike:1.1067
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.1066 2010/05/10 14:22:25 grubba Exp $";
+ constant cvs_version="$Id: roxen.pike,v 1.1067 2010/06/03 12:07:25 noring Exp $";
//! @appears roxen
//!
1393: Inside #if defined(THREADS)
// stop_handler_threads is running; ignore more work.
return 0;
- function enqueue = lambda()
+ class enqueue(function func, mixed ... args)
{
-
+ int __hash() { return hash_value(func); }
+ int `==(mixed gunc) { return func == gunc; }
+ string _sprintf() { return sprintf("background_run(%O)", func); }
+ mixed `()()
+ {
bg_queue->write (({func, args}));
if (!bg_process_running)
handle (bg_process_queue);
-
+ }
};
- // Be careful to zero enqueue below to avoid trampoline garbage.
-
+
if (delay)
- // A trick to zero enqueue without putting the call_out return
- // value into a local variable.
- return call_out (enqueue, (enqueue = 0, delay));
+ return call_out (enqueue(func, @args), delay);
else {
- enqueue();
- enqueue = 0;
+ enqueue(func, @args)();
return 0;
}
#else
1502:
}
}
- string _sprintf() {return "BackgroundProcess()";}
+ string _sprintf()
+ {
+ return sprintf("BackgroundProcess(%O, %O)", period, func);
}
-
+ }
mapping get_port_options( string key )