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

Re: [MirageOS-devel] Error handling in Mirage - request for comments!



On Wed, 4 Feb 2015 11:52:28 +0000, Thomas Leonard wrote:
> 
> On 3 February 2015 at 23:16, Christophe Troestler
> <Christophe.Troestler@xxxxxxxxxxx> wrote:
> > On Mon, 2 Feb 2015 12:30:39 +0000, Thomas Leonard wrote:
> >>
> >> let bind t f =
> >>   let t = repr t in
> >>   match t.state with
> >>     | Return v ->
> >>         f v
> >>     | Fail _ as state ->
> >>         thread { state }
> >>     | Sleep sleeper ->
> >>         let res = temp t in
> >>         let data = !current_data in
> >>         add_immutable_waiter sleeper
> >>           (function
> >>              | Return v -> current_data := data; connect res (try f v
> >> with exn -> fail exn)
> >>              | Fail _ as state -> fast_connect res state
> >>              | _ -> assert false);
> >>         res
> >
> > Thanks for checking.  At first, the difference of treatment between
> > the two âf vâ is a little odd.  Do you happen to know the reason for
> > it?
> 
> I assume it's a speed optimisation

Thinking a bit more about this, I wonder whether it may be more
fundamental: when the state is âReturnâ, the exception will travel the
chain of calls of the same "thread" up until it reaches a handler â so
one can dispense putting a handler â, when it is âSleepâ, it is
possible that it escape the current thread.

[Will read the rest later â at a meeting...]

Best,
C.

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.