sks-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sks-devel] On-demand SKS Statistics Generation?


From: Kim Minh Kaplan
Subject: Re: [Sks-devel] On-demand SKS Statistics Generation?
Date: Fri, 03 Jul 2009 08:21:31 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Peter Pramberger:

> Fixed version, however this still calculates the stats inside the signal
> handler. I tried to use Eventloop.Event() to trigger the calculation, but no
> success:
>
>   let calc_stats_on_sig () =
>     let now = Unix.gettimeofday () in
>     ignore (Eventloop.Event (now, Eventloop.Callback calculate_stats_page))
>
> Any ideas?

Eventloop does not give you access to the event queue.  Attached is a
kludge to do that.  I do *not* think this is a nice solution.  Better
would be to add signal handling semantic to eventloop.ml.

Kim Minh.

diff -r a86b082a3067 dbserver.ml
--- a/dbserver.ml       Sun Jun 07 15:39:48 2009 +0200
+++ b/dbserver.ml       Fri Jul 03 10:14:01 2009 +0200
@@ -632,6 +632,11 @@
   let () = Sys.set_signal Sys.sigusr1
          (Sys.Signal_handle (fun _ -> sync_db_on_sig ()))
 
+  let () = Sys.set_signal Sys.sigusr2
+      (Sys.Signal_handle (fun _ ->
+       Eventloop.add_events Eventloop.heap
+         [Eventloop.Event(0.0, Eventloop.Callback calculate_stats_page)]))
+
   (***********************************************************************)
 
   let run () = 
diff -r a86b082a3067 eventloop.ml
--- a/eventloop.ml      Sun Jun 07 15:39:48 2009 +0200
+++ b/eventloop.ml      Fri Jul 03 10:14:01 2009 +0200
@@ -227,8 +227,9 @@
 (***************************************************************)
 (***************************************************************)
 
+let heap = Heap.empty (<) 20
+
 let evloop events socklist = 
-  let heap = Heap.empty (<) 20 in
   add_events heap events;
   try
     while true do

reply via email to

[Prev in Thread] Current Thread [Next in Thread]