Le jeudi 15 juillet 2010 22:52:53, Goswin von Brederlow a écrit :
> The main task will only process priority 0 events and bounce between
> main_task and with_checksum while the worker threads process priority 1
> events and do_checksum.
> 
> Correct?

I think it should be like this:

let do_checksum buf _ =
  let sum = ...
  in
  reply_request ();
  []

let main () =
  let scheduler = Duppy.create ()
  in
    for i = 1 to num_cores do
      Thread.create (Duppy.queue ~priorities=(fun x -> x = 1) scheduler 
"worker") ();
    done;
    while (* New checksum need to be computed *) do
     Duppy.Task.add scheduler
       { priority = 1; events = [`Timeout 0.]; handler = fun _ -> do_checksum 
buf; }
     done

It seems in your case you do not need finer-grained priority and all the 
workers live at the same priority level..

Now, the main thread does not need to be a task.. 


Romain

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to