Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A56A4C433F5 for ; Sun, 28 Nov 2021 21:23:51 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4J2M116zVfz2xtQ for ; Mon, 29 Nov 2021 08:23:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=stwcx.xyz header.i=@stwcx.xyz header.a=rsa-sha256 header.s=fm3 header.b=O5zWn1h0; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=FcCCZj+F; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=stwcx.xyz (client-ip=66.111.4.27; helo=out3-smtp.messagingengine.com; envelope-from=patrick@stwcx.xyz; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=stwcx.xyz header.i=@stwcx.xyz header.a=rsa-sha256 header.s=fm3 header.b=O5zWn1h0; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=FcCCZj+F; dkim-atps=neutral Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4J2M0935jRz2xDV for ; Mon, 29 Nov 2021 08:23:04 +1100 (AEDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 49C375C00DB for ; Sun, 28 Nov 2021 16:22:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 28 Nov 2021 16:22:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stwcx.xyz; h= date:from:to:subject:message-id:mime-version:content-type; s= fm3; bh=3ITeRQYD6BPpjG4XsgEQDz3iU93lWGozS5XI4TsLNnw=; b=O5zWn1h0 QihO9SqxnlRVULkctUWqo11KcsuSPNYZR/AEJSChvwf9PyQNIfyCoYCytQ1YIxrS eaxbXS9p92h2Xb4MG4w0nOmOACCShJBnmflpu0+FiMvYGz77qqcCFGl4fdj75xO6 uPpOFgMTy9wk7LQLgu2O0H9YuGSgbvIBc0JlHXsaZpJp8rYdM1TNVAZCkt8dxQS3 nuHmWmVgBQbOSsj6fL72FEVZEATfDaUaLR+nDTfTr5qv6PKrmzizWGP8z32A+53h +zTILAQIlPJKhfyu6UJfK7BY52/qtpYE5YUI82PIWKE4cTqP+37E+KdfSHmqlatN uNoxWiLX+DftgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=3ITeRQYD6BPpjG4XsgEQDz3iU93lW GozS5XI4TsLNnw=; b=FcCCZj+F/Ms2Xx4H9M1b5MA9Yk3Cinum3LgS+iJoNR3sT UmLTDF/TyQ2Is0cCp57c94EQP51g9N8tnLjBRAUlLtRkpRzUHM3HsghqSEdz+COj paYJ/lpBrhyCIMroPa4QDc8YTIlJf8/hFKzGUyfZ6h2LvKdMe4qpXxGXwqz/E6dr c4zpow4Qm+x5c9K7LjplyxCSS03WH8+JZ8S9KNmhGpxlkbvmZl1Y+ju90d0TSTuC AqE+sxiKRq3MhCA5Ki3J9L/4d8Mz43+bMO3WCeWsIOj280jinu64txQleOl1bXBH L84AA8t39oX5BrK8SnaKuwZ5CdDjRp0/HfCThqWLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrheeigdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkgggtugesghdtreertddtvden ucfhrhhomheprfgrthhrihgtkhcuhghilhhlihgrmhhsuceophgrthhrihgtkhesshhtfi gtgidrgiihiieqnecuggftrfgrthhtvghrnhepffetvddtieehieehjeeitdejvdelgfdt ffeltdfgveeutedugfekudeihedviefgnecuffhomhgrihhnpehophgvnhgsmhgtqdhprh hojhgvtghtrdighiiipdhgihhthhhusgdrtghomhdphihouhhtuhgsvgdrtghomhenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehprghtrhhitg hksehsthiftgigrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 28 Nov 2021 16:22:58 -0500 (EST) Date: Sun, 28 Nov 2021 15:22:57 -0600 From: Patrick Williams To: OpenBMC List Subject: C++ co-routines are coming soon... Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZE80Bit118szcPIe" Content-Disposition: inline X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" --ZE80Bit118szcPIe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, I just pushed up some code I've been working on for initial community previ= ew: C++20 coroutine support in sdbusplus[1]. This code should be considered "experimental" for the time-being but a good preview of where I plan to tak= e the sdbusplus bindings. I know there are complaints about the current sdbusplus support in one of three veins depending on your perspective of importance: 1. The current sdbusplus server bindings in phosphor-dbus-interfaces are synchronous. 2. There are no sdbusplus client bindings in phosphor-dbus-interfaces. 3. The code using the sdbusplus Boost/ASIO interfaces is very callback intensive (and difficult to read). I've been wanting to leverage C++20 coroutines for quite a while in order to address these shortcomings but haven't gotten around to it due to lack of understanding on my part (and lack of time to fix this) and lack of maturit= y in the library support. There is a proposal for C++23 (P2300)[2] which attemp= ts to fix the "maturity" problem and the authors of that have been using libunife= x[3] as their proving ground. Using libunifex and becoming enlightened by Eric Niebler's excellent talk at CppCon'21, I've finally been able to make some = good progress on this. There will be more to come, but I wanted to give a taste of what a C++20 co-routine-based sdbusplus agent might look like. This is an example of a task that reacts to D-Bus "NameOwnerChanged" signals: ``` auto watch_events(sdbusplus::async::context_t& ctx) -> sdbusplus::execution::task { using namespace sdbusplus::async::match; auto m =3D match(ctx, rules::nameOwnerChanged()); while (auto msg =3D co_await m.next()) { std::string service, old_name, new_name; msg.read(service, old_name, new_name); if (!new_name.empty()) { std::cout << new_name << " owns " << service << std::endl; } else { std::cout << service << " released" << std::endl; } }; co_return; } ``` I currently have `match` implemented and I plan to get `call` working very = soon. Sometime between now and late January I'll probably do an educational talk = on co-routines. 1. https://gerrit.openbmc-project.xyz/c/openbmc/sdbusplus/+/49117 2. https://github.com/cplusplus/papers/issues/1054 3. https://github.com/facebookexperimental/libunifex 4. https://www.youtube.com/watch?v=3DxLboNIf7BTg --=20 Patrick Williams --ZE80Bit118szcPIe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEBGD9ii4LE9cNbqJBqwNHzC0AwRkFAmGj8y8ACgkQqwNHzC0A wRkbDBAAiWW8p0rnlkD8bEE29WC0rh3dMvffWFxxYqKISCW2zqvWPBWSZ3Re3JQm eeDeP5YgApU6b+XkJX+h/tz3Fy6pxpYRaGVpFOCaNodhWmmaTzk5EZBY63OyKgXn vUcb9R04ZwVLXAZjkM+YwpA1lqq4glSiDp89DodP0LL9ILH/pVEFP2/S08PpWbwj +cgKuZjRc4IklBzQy2rLIDaF9NgrgXIwrevb62MDP4DDcVBaAkK1T6jLJB7UA4kA pW+H59DjGfTxEm5ebWBhghS6p/+7d6rz+VLdLbcrhtRkEpTft17n78T7Y/c8Nilj 8XSKmyx+GzOy4digsiqGaXkTNrECW5mW3AMmTC5WElRBkCre69AQl4pKKMSGnRfW pMlGqMIiCNYOjhq16V/L1UojBTxPPuh8FnvQxO3to87Q0w9czNWcmhV22wTsHk/6 GCJLJAqaBAAjV3XMcnF/ErZoxD60hDi0SSOujU4/1dfEtpO1KZxo8p3EfDav40yL HYA8LbPaVFdZQSdtSLUTmWxpTXKjzT13DqRavvWXq5q8DA7vNb34ixTJr4vx/s8s nNSvqUyxuBO15GK5+BiDkcpbkRQKyFfci03O+2vI+FghCto88kjdwdzj/XwP8x43 7N0OqQZ/7nxc6A8n5ls+IaQwCQ58qnXrkjOdfPe+H1ABBTnoubs= =9gaH -----END PGP SIGNATURE----- --ZE80Bit118szcPIe--