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 07C6D7F893 for ; Wed, 19 Mar 2014 13:01:58 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of rich.neswold@gmail.com) identity=pra; client-ip=209.85.220.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich.neswold@gmail.com"; x-sender="rich.neswold@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of rich.neswold@gmail.com designates 209.85.220.48 as permitted sender) identity=mailfrom; client-ip=209.85.220.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich.neswold@gmail.com"; x-sender="rich.neswold@gmail.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@mail-pa0-f48.google.com) identity=helo; client-ip=209.85.220.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich.neswold@gmail.com"; x-sender="postmaster@mail-pa0-f48.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqMBAJGGKVPRVdwwlGdsb2JhbABahBiDBr9HgRIIFg4BAQEBBwsLCRIqgiUBAQEEIx0BGx0BAwwGBQsNAgImAgIiAREBBQEcBhOHZAEDEaEPjA5Rgw6WZwoZJw1khi4RAQUMgR2FSYdAMweCb4FJBIlSjnWQQhgphHgf X-IPAS-Result: AqMBAJGGKVPRVdwwlGdsb2JhbABahBiDBr9HgRIIFg4BAQEBBwsLCRIqgiUBAQEEIx0BGx0BAwwGBQsNAgImAgIiAREBBQEcBhOHZAEDEaEPjA5Rgw6WZwoZJw1khi4RAQUMgR2FSYdAMweCb4FJBIlSjnWQQhgphHgf X-IronPort-AV: E=Sophos;i="4.97,685,1389740400"; d="scan'208";a="63620702" Received: from mail-pa0-f48.google.com ([209.85.220.48]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 19 Mar 2014 13:01:57 +0100 Received: by mail-pa0-f48.google.com with SMTP id hz1so8862254pad.35 for ; Wed, 19 Mar 2014 05:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=xzGhBLJbCsuC980s8kvdOEnsqHqNpJETW5/+rPSHtk8=; b=DWFsfr5f2qe5wazH2qmy1ji8OhIIymmHEIkMCG8Zj6jxwbdwPpSl8HbhVA59nlE/2G VWEPx+lYCBTbiTea53Y/rboc6gLg5vmP5ZVNOW0faPzfO3yQShq9JfMhAlReKvDRja/J 9N4CA7N7QEnOii1Qat0LR9wkM8/7r3Vd4egCCAWDyWj958r8tKgbBudzrhJqVPkDlr2A GE8xl1UMs+7qVzW9e+t07ZFdZ3tNruZ/kcaCdK47h+QyX6mB0VMRa22t3zPI1+NsWZTZ Om0TBv4BwbTGJtorzQl4GakmY/HYYHatdoNLL9JgaxlQBzLk3+jxI7E3qRLUT+DlfIBl wdew== MIME-Version: 1.0 X-Received: by 10.68.197.36 with SMTP id ir4mr38284758pbc.46.1395230515819; Wed, 19 Mar 2014 05:01:55 -0700 (PDT) Received: by 10.68.59.7 with HTTP; Wed, 19 Mar 2014 05:01:55 -0700 (PDT) In-Reply-To: References: <1732E7D3-C154-4305-90C8-0CC292FE08CF@gmail.com> <8738ihru8r.fsf@golf.niidar.ru> <3B63CC7A2A994E018E1EC2E450E0FFF4@erratique.ch> <2F20BDD4-4475-4250-921F-E4CDB34BFD86@gmail.com> Date: Wed, 19 Mar 2014 07:01:55 -0500 Message-ID: From: Rich Neswold To: =?UTF-8?Q?Daniel_B=C3=BCnzli?= Cc: OCaml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] OpenGL and LWT On Mon, Mar 17, 2014 at 6:50 PM, Daniel B=C3=BCnzli wrote: > There is certainly more than one way to do that, but that's what I do at = the moment (with another cooperative threading library). Favor the treateme= nt of the UI events, if there's no UI event run the scheduler for 10ms. > > let rec loop deadline =3D > while Sdl.poll_event e do do_event e done; > run_scheduler ~timeout:10; > loop () > > Regarding Tsdl.Sdl.wait_event, it's not really better than that, if you h= ave a look at its C implementation [1] you'll see it tries to get an event = and if none is available it will sleep for 10ms before trying again. This m= eans that any SDL based program using Sdl.wait_event, constantly uses ~1.5%= cpu (at least on osx), you should be able to bring that down by writing yo= ur own loop as above and augmenting the timeout value when your application= is not in the foreground. Thank you for all your help! I'll approach the problem using SDL. --=20 Rich