From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 2434A7EE4B for ; Fri, 18 Oct 2013 11:02:37 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhgCAKD4YFImacjlnGdsb2JhbABaDoMxUqs7iheIRYEbHg4BAQEBAQYWCTyCJQEBBAFAAQEsCwEECwsEBxohIhIBBQEKEgYTEodiAwkGAwmiGIsNhFIBBYRbA4lvBo9NBAeEKZgMgS+ObBgphBBAgWYE X-IPAS-Result: AhgCAKD4YFImacjlnGdsb2JhbABaDoMxUqs7iheIRYEbHg4BAQEBAQYWCTyCJQEBBAFAAQEsCwEECwsEBxohIhIBBQEKEgYTEodiAwkGAwmiGIsNhFIBBYRbA4lvBo9NBAeEKZgMgS+ObBgphBBAgWYE X-IronPort-AV: E=Sophos;i="4.93,521,1378850400"; d="scan'208";a="37612364" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Oct 2013 11:02:34 +0200 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VX5x3-0003pA-NJ for caml-list@yquem.inria.fr; Fri, 18 Oct 2013 05:02:33 -0400 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VX5x3-0003jQ-Ly for caml-list@yquem.inria.fr; Fri, 18 Oct 2013 05:02:33 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1VX5x3-0005YX-Hd for caml-list@yquem.inria.fr; Fri, 18 Oct 2013 05:02:33 -0400 Received: by mail-ie0-f172.google.com with SMTP id tp5so6188148ieb.17 for ; Fri, 18 Oct 2013 02:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=nGK0Z0rREmSYcVsmNBfaVUqhJabvfbAXSqxA0E3Sfu8=; b=q8uXFLNu9IroBzHgytjf/94VvopEmOWj7apO2AC0rjUa7BRb6iYgHhT/R6LVS7id5M VmvXy6eXp2YpPfW+Phimjb6Adq32sjEGY+7ru0SGBvjqHp7j2DFnL17cDUJNv8VLIsDB DxPq0ExMSGJy3/wSqGTgFUsTRPrI16g4zLIQ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=nGK0Z0rREmSYcVsmNBfaVUqhJabvfbAXSqxA0E3Sfu8=; b=DG/2lTyP2+s0YhDVDwJ4QigpPG1eCAoMAKAHD0X1LpTFlMajCqCa+VcQWs8ly4zEXo BOd+Wop6KHg+NPqiN8/TQLXiEpO/b+e7P8AK8OVR64ltwmfCIXpq1xpGC+/URTDr7Zat 290H+TW5yTmyO/dMA1HXo8Sx/nIHjqDMyYWSoNFqG+y/1W/pVBv/N7T3uboCL+4yX3As 86vv9HU/y9FGNX9gtCICc93LpmFOELAU/awZt+nA21YJdXtTAjfPxFK/crbMTP2PUXQs ga8hhdGz6QXM9aH2ienxOEjpkoI6Eo289kZagIi4131rVQJ4gNhG+9EWomxP2wkezdiO cUag== X-Gm-Message-State: ALoCoQl9Q+LfpGjyQ58KCh+C9j2M5dY88apPYIrgXovRU2OdNVVSLs6H0k85LpgburcuTj88JatJLtqVgGZ2FwIZQ9l+JglnUX3EjYCCkuzV0wIoLdkaeg9Z/NZ9eNhVHDPMFlsFgGrpoX6rwfkxqhs3pzOWn8Q66XsR61dYgBF/whgY66buElI= X-Received: by 10.43.180.200 with SMTP id pf8mr616706icc.50.1382086953316; Fri, 18 Oct 2013 02:02:33 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.43.180.200 with SMTP id pf8mr616690icc.50.1382086953158; Fri, 18 Oct 2013 02:02:33 -0700 (PDT) Received: by 10.50.170.40 with HTTP; Fri, 18 Oct 2013 02:02:33 -0700 (PDT) In-Reply-To: References: Date: Fri, 18 Oct 2013 10:02:33 +0100 Message-ID: From: Jeremie Dimino To: Nicolas Ojeda Bar Cc: "caml-list@yquem.inria.fr" Content-Type: multipart/alternative; boundary=001a11c3ad4ce45f4504e9003153 Subject: Re: [Caml-list] async exceptions with lwt/async? --001a11c3ad4ce45f4504e9003153 Content-Type: text/plain; charset=ISO-8859-1 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 --001a11c3ad4ce45f4504e9003153 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

There is no real equivalent o= f Haskell's killthread in lwt or async. The closest in lwt is Lwt.cance= l: if a thread is blocked on a cancelable operation, this one will fail wit= h Lwt.Canceled. Cancelable operations include: sockets and pipes IO, sleepi= ng, waiting on an mvar, etc...

In async the way to do it is to pass an &qu= ot;interrupt" deferred (basically just a [unit Deferred.t] value) down= to low-level fd operations. When this deferred becomes determined the oper= ation in progress will be interrupted.

Hope that helps,
Jeremie


On T= hu, Oct 17, 2013 at 7:34 PM, Nicolas Ojeda Bar <N.Ojeda.Bar@dpmm= s.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. =A0Subscription management and archives:
ht= tps://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
--001a11c3ad4ce45f4504e9003153--