From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 DD21C7F860 for ; Mon, 17 Mar 2014 11:09:30 +0100 (CET) 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@mx5.mail.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@mx5.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlMBAFLJJlMmacjlnGdsb2JhbABZhBjCAYESHg4BAQEBAQYWCTyCJQEBAQMBQAEBNwEECwsEBwM4IQESAQUBHAYTh2UDCQgDAqQfixiEVQEFlnENhy8RBoxQghgHhDiUXoF/gW2MZ4NaGCmEWg X-IPAS-Result: AlMBAFLJJlMmacjlnGdsb2JhbABZhBjCAYESHg4BAQEBAQYWCTyCJQEBAQMBQAEBNwEECwsEBwM4IQESAQUBHAYTh2UDCQgDAqQfixiEVQEFlnENhy8RBoxQghgHhDiUXoF/gW2MZ4NaGCmEWg X-IronPort-AV: E=Sophos;i="4.97,669,1389740400"; d="scan'208";a="63210744" Received: from mx5.janestreet.com (HELO mx5.mail.janestreet.com) ([38.105.200.229]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Mar 2014 11:09:30 +0100 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by mx5.mail.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WPUU2-0002kA-Tn for caml-list@inria.fr; Mon, 17 Mar 2014 06:09:26 -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 1WPUU2-0001um-Sl for caml-list@inria.fr; Mon, 17 Mar 2014 06:09:26 -0400 Received: from mail-ig0-f179.google.com ([209.85.213.179]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WPUU2-0004K2-PR for caml-list@inria.fr; Mon, 17 Mar 2014 06:09:26 -0400 Received: by mail-ig0-f179.google.com with SMTP id t19so4990254igi.0 for ; Mon, 17 Mar 2014 03:09:26 -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=y1SfuKvIfLR000lBHvKEoiwNoxZ1wi/hUlOllkAAniM=; b=UunRreLZV3IYb4IlOKMR7zEhNpH8a7cOEStZut4nAMIDOQH4+Dp6jdjbGjWNAgTGdg iyzXeXjoEs1gUXYvjfqjwLrlZBFRIrRWKOgErMtUVt8135z0k/7fd1BQL4x92DNxab0P TOYbLy5gJbtBoro7aJ8P5NkNWZM0q4JRS3Q5I= 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=y1SfuKvIfLR000lBHvKEoiwNoxZ1wi/hUlOllkAAniM=; b=YsNa+mdo5F06QIXwLCYw77qn+zACxwPAqW7dPZnptextJwLHRpF/fjYJlmEM622+Jj zVy6Z6Qi+5eS22Fr7Pyx3JU3QszwL5mg1v0p2n1Ssqi0diSQPSDr5VIFb5CJ+Rt1NstG j+a713qiuBEye09ov1PynhOR6mwvWXCDjxIpQQUImh35SGlun3xYSf0AsyIllqmyBI2T 01rWe2lOlND7p+hNPqPsx/Cn8HhtzJLG1xgMEizImcYbl2RJAh1WKjA6KfKqFJpf7pnP a3pHwuxEKBO5BrxYNSacNrFosK8jhWW58AndAFTtgeab/fFjRQ2yBjOU1PJysv9pkqPK 4BwA== X-Gm-Message-State: ALoCoQmMzuyrFcJ8C9E/a2s2rIfJ6P2cV+PoljkXn/Kz5x5Fu7wJ0iiHBqXnqLm0Vx/0V3a8a3KQGDmSHoYdlAEttnqt0IisouXFP7Tj3OkFXLkizGamLKNiFGD1dKq4mPCsyrti5mytGWJQi5hMrbFOCdJSl7PuXg== X-Received: by 10.50.79.193 with SMTP id l1mr11988556igx.36.1395050966549; Mon, 17 Mar 2014 03:09:26 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.79.193 with SMTP id l1mr11988545igx.36.1395050966435; Mon, 17 Mar 2014 03:09:26 -0700 (PDT) Received: by 10.50.114.38 with HTTP; Mon, 17 Mar 2014 03:09:26 -0700 (PDT) In-Reply-To: <1732E7D3-C154-4305-90C8-0CC292FE08CF@gmail.com> References: <1732E7D3-C154-4305-90C8-0CC292FE08CF@gmail.com> Date: Mon, 17 Mar 2014 10:09:26 +0000 Message-ID: From: Jeremie Dimino To: Richard Neswold Cc: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=089e01183eda4c61b004f4ca9d4f Subject: Re: [Caml-list] OpenGL and LWT --089e01183eda4c61b004f4ca9d4f Content-Type: text/plain; charset=ISO-8859-1 Hi, On Sat, Mar 15, 2014 at 5:37 PM, Richard Neswold wrote: > Hello, > > What would be the appropriate way to use LWT and LabGL together? > > My gut feeling would be to have the core model and logic to be LWT with a > 'detached' thread executing the OpenGL main loop. The thread would get > events through the reactive module and would update the display accordingly. > > The problem is I'm still trying to wrap my head around LWT and I'm not > sure a detached thread can participate with the LWT environment it was > spawned from. It appears the detached thread is supposed to do something > and eventually return a value. > Yes, the purpose of Lwt_preemptive.detach is to execute a blocking action in a separate system thread in order not to block all lwt threads. And from another system thread you cannot run lwt code directly, you have to use Lwt_preemptive.run_in_main. > Is the correct approach to use a detached thread to make the individual > OpenGL calls? > I think that would be very slow, as in involves system thread synchronization. > Any recommendations or resources on the subject would be appreciated. > You could try to assume that OpenGL calls are fast and perform them in the same thread as lwt. -- Jeremie --089e01183eda4c61b004f4ca9d4f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,

On Sat, Mar 15, 2014 at 5:37 PM, Richard Neswold &= lt;rich.neswold= @gmail.com> wrote:
Hello,

What would be the appropriate way to use LWT and LabGL together?

My gut feeling would be to have the core model and logic to be LWT with a &= #39;detached' thread executing the OpenGL main loop. The thread would g= et events through the reactive module and would update the display accordin= gly.

The problem is I'm still trying to wrap my head around LWT and I'm = not sure a detached thread can participate with the LWT environment it was = spawned from. It appears the detached thread is supposed to do something an= d eventually return a value.

Yes, the purpose of Lwt_preemptive.d= etach is to execute a blocking action in a separate system thread in order = not to block all lwt threads. And from another system thread you cannot run= lwt code directly, you have to use Lwt_preemptive.run_in_main.
=A0
Is the correct approach to use a detached thread to make the individual Ope= nGL calls?

I think that would be = very slow, as in involves system thread synchronization.=A0
=A0
Any recommendations or resources on the subject would be appreciated.

You could try to assume =A0that = OpenGL calls are fast and perform them in the same thread as lwt.

--
Jeremie
--089e01183eda4c61b004f4ca9d4f--