* [Caml-list] async exceptions with lwt/async?
@ 2013-10-17 18:34 Nicolas Ojeda Bar
2013-10-18 9:02 ` Jeremie Dimino
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Ojeda Bar @ 2013-10-17 18:34 UTC (permalink / raw)
To: caml-list
Hi,
Is there a way to raise an exception in a different thread than the
currently executing one with lwt? What about J. Street's async?
I am essentially looking for a replacement of Haskell's 'killthread'.
Thank you very much,
Nicolas
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] async exceptions with lwt/async?
2013-10-17 18:34 [Caml-list] async exceptions with lwt/async? Nicolas Ojeda Bar
@ 2013-10-18 9:02 ` Jeremie Dimino
0 siblings, 0 replies; 2+ messages in thread
From: Jeremie Dimino @ 2013-10-18 9:02 UTC (permalink / raw)
To: Nicolas Ojeda Bar; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]
Hi,
There is no real equivalent of Haskell's killthread in lwt or async. The
closest in lwt is Lwt.cancel: if a thread is blocked on a cancelable
operation, this one will fail with Lwt.Canceled. Cancelable operations
include: sockets and pipes IO, sleeping, waiting on an mvar, etc...
In async the way to do it is to pass an "interrupt" deferred (basically
just a [unit Deferred.t] value) down to low-level fd operations. When this
deferred becomes determined the operation in progress will be interrupted.
Hope that helps,
Jeremie
On Thu, Oct 17, 2013 at 7:34 PM, Nicolas Ojeda Bar <
N.Ojeda.Bar@dpmms.cam.ac.uk> wrote:
> Hi,
>
> Is there a way to raise an exception in a different thread than the
> currently executing one with lwt? What about J. Street's async?
>
> I am essentially looking for a replacement of Haskell's 'killthread'.
>
> Thank you very much,
> Nicolas
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
--
Jeremie
[-- Attachment #2: Type: text/html, Size: 1941 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-18 9:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-17 18:34 [Caml-list] async exceptions with lwt/async? Nicolas Ojeda Bar
2013-10-18 9:02 ` Jeremie Dimino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox