[{"id":23430,"web_url":"https://patchwork.libcamera.org/comment/23430/","msgid":"<20220616110639.raznhr2mlu5czsgq@uno.localdomain>","date":"2022-06-16T11:06:39","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Daniel,\n\n   I wonder if we shouldn't just drop the whole\n\nStart an event loop\n~~~~~~~~~~~~~~~~~~~\n\nparagraph\n\nOn Wed, Jun 15, 2022 at 06:26:01PM +0200, Daniel Semkowicz via libcamera-devel wrote:\n> Event loop was moved to be a part of CameraManager, so it is no longer\n> a user responsibility to control the event dispatching.\n> ---\n>  .../guides/application-developer.rst          | 20 ++++++++++---------\n>  1 file changed, 11 insertions(+), 9 deletions(-)\n>\n> diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst\n> index 00bafb10..97c032a5 100644\n> --- a/Documentation/guides/application-developer.rst\n> +++ b/Documentation/guides/application-developer.rst\n> @@ -27,10 +27,12 @@ defined names and types without the need of prefixing them.\n>     #include <iomanip>\n>     #include <iostream>\n>     #include <memory>\n> +   #include <thread>\n>\n>     #include <libcamera/libcamera.h>\n>\n>     using namespace libcamera;\n> +   using namespace std::chrono_literals;\n>\n>     int main()\n>     {\n> @@ -506,7 +508,7 @@ and queue all the previously created requests.\n>     for (std::unique_ptr<Request> &request : requests)\n>         camera->queueRequest(request.get());\n>\n> -Start an event loop\n> +Event loop\n>  ~~~~~~~~~~~~~~~~~~~\n>\n>  The libcamera library needs an event loop to monitor and dispatch events\n> @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n>  notifiers' signals and emit application visible events, such as the\n>  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n>\n> -The code below retrieves a reference to the system-wide event dispatcher and for\n> -the a fixed duration of 3 seconds, processes all the events detected in the\n> -system.\n> +Event loop is handled internally by ``CameraManager`` instance in a separate\n> +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> +loop processing.\n> +\n> +As the ``CameraManager`` was already started in our example, we need to prevent\n> +the immediate termination of the application. The code below pauses the main\n> +thread for 3 seconds, so that the event loop thread can process the requests.\n>\n>  .. code:: cpp\n>\n> -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> -   Timer timer;\n> -   timer.start(3000);\n> -   while (timer.isRunning())\n> -       dispatcher->processEvents();\n> +   std::this_thread::sleep_for(3000ms);\n>\n>  Clean up and stop the application\n>  ---------------------------------\n> --\n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 467A3BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 16 Jun 2022 11:06:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8C68965631;\n\tThu, 16 Jun 2022 13:06:42 +0200 (CEST)","from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::221])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 78C79600F0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Jun 2022 13:06:41 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id CF3E4240002;\n\tThu, 16 Jun 2022 11:06:40 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655377602;\n\tbh=XLSfAvrYG06ygAYsYGqQWdmBbtkjBlvUnHv5SsBQLSY=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=nsMnKvXukj8jgJmm/V/wODlRfsIBSQ39QLMwIfiZx33AmQBV5Yb5PvjwmgKEzG4WD\n\tH8aLFijyfIuogVDVHo0bK8Vlrfb+fV+0Jnm9E5yM9CKN/iTehD7oJseXpQe0I7uHtW\n\te2dMH7LxP6bQM7OiR1fuTMLdBV0zoNXwQDJwNeQ/x/+XbAg7NIjJ6Cl5AJDsi6O8Lr\n\tY28o7sVVslmb+ACG4EwmdI/wti7QpEkAlMIYgcOOZsFxqv2E3CAcryAXlLV6dpy/o+\n\tk2d2SB6STZTuvGjCaPfwmcXSlidt/R3y6BkIGcYqZkY4502/It4ERJsx4/VJJZgJP8\n\tiYdA4iNDCWAOw==","Date":"Thu, 16 Jun 2022 13:06:39 +0200","To":"Daniel Semkowicz <dse@thaumatec.com>","Message-ID":"<20220616110639.raznhr2mlu5czsgq@uno.localdomain>","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220615162601.48619-4-dse@thaumatec.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23433,"web_url":"https://patchwork.libcamera.org/comment/23433/","msgid":"<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>","date":"2022-06-17T07:24:50","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":126,"url":"https://patchwork.libcamera.org/api/people/126/","name":"Daniel Semkowicz","email":"dse@thaumatec.com"},"content":"Hi Jacopo,\n\nOn Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> Hi Daniel,\n>\n>    I wonder if we shouldn't just drop the whole\n>\n> Start an event loop\n> ~~~~~~~~~~~~~~~~~~~\n>\n> paragraph\n>\n\nI was also thinking about that when I was editing the current text.\nIt is always the decision on how many details about the internal\narchitecture We want to present to the developer in this guide.\nAs it is the introduction guide then maybe indeed it will be better to\nkeep it simple and do not talk too much about the internals.\n\nThere will still be this one \"sleep_for(3000ms)\" line needed and I think\nit would be good to leave some short explanation why it is here. Do you\nthink that adding it at the end of \"Request queueing\" section is a good\nidea or should I create a separate section about it?\n\nBest regards\nDaniel\n\n\n> On Wed, Jun 15, 2022 at 06:26:01PM +0200, Daniel Semkowicz via libcamera-devel wrote:\n> > Event loop was moved to be a part of CameraManager, so it is no longer\n> > a user responsibility to control the event dispatching.\n> > ---\n> >  .../guides/application-developer.rst          | 20 ++++++++++---------\n> >  1 file changed, 11 insertions(+), 9 deletions(-)\n> >\n> > diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst\n> > index 00bafb10..97c032a5 100644\n> > --- a/Documentation/guides/application-developer.rst\n> > +++ b/Documentation/guides/application-developer.rst\n> > @@ -27,10 +27,12 @@ defined names and types without the need of prefixing them.\n> >     #include <iomanip>\n> >     #include <iostream>\n> >     #include <memory>\n> > +   #include <thread>\n> >\n> >     #include <libcamera/libcamera.h>\n> >\n> >     using namespace libcamera;\n> > +   using namespace std::chrono_literals;\n> >\n> >     int main()\n> >     {\n> > @@ -506,7 +508,7 @@ and queue all the previously created requests.\n> >     for (std::unique_ptr<Request> &request : requests)\n> >         camera->queueRequest(request.get());\n> >\n> > -Start an event loop\n> > +Event loop\n> >  ~~~~~~~~~~~~~~~~~~~\n> >\n> >  The libcamera library needs an event loop to monitor and dispatch events\n> > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> >  notifiers' signals and emit application visible events, such as the\n> >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> >\n> > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > -system.\n> > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > +loop processing.\n> > +\n> > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > +the immediate termination of the application. The code below pauses the main\n> > +thread for 3 seconds, so that the event loop thread can process the requests.\n> >\n> >  .. code:: cpp\n> >\n> > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > -   Timer timer;\n> > -   timer.start(3000);\n> > -   while (timer.isRunning())\n> > -       dispatcher->processEvents();\n> > +   std::this_thread::sleep_for(3000ms);\n> >\n> >  Clean up and stop the application\n> >  ---------------------------------\n> > --\n> > 2.34.1\n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D05CCBD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 07:25:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 119E265638;\n\tFri, 17 Jun 2022 09:25:04 +0200 (CEST)","from mail-lf1-x136.google.com (mail-lf1-x136.google.com\n\t[IPv6:2a00:1450:4864:20::136])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B8A0633A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 09:25:02 +0200 (CEST)","by mail-lf1-x136.google.com with SMTP id h23so5640700lfe.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 00:25:02 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655450704;\n\tbh=BY5GvyFt31tG3UUNWy/K89VRyOudfVlgjynDmYBquHI=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=aghVyFUedrOx7b2Io+N2GIt47LxD1z4GqcMcTvrhZW5dqAJI1updNMeq6Z+I3Rf8g\n\t0gXMuamcXGmV65M765vzIMU9AMQpM/OsERVgzu9004+v8YXkLPNsuGfj7EQY4NFkwr\n\tCgYlDs3wZsyfaH2APwggZOpy6lGetyXp5Kis9ga5jG3byC9K7ZqUWfXFR1/NbyawQT\n\tJN5VKbrdUhp20bUc7/JXaoQzhHN649ENDXQpBBgNBpoVYmiuW9PeKk7GIugEzSqTt8\n\tcJlKQBjGhl5sFks9QugYe0K4znBLLPX4cXRS/A55LM1spDrjiqk6BFa/7VRlqHwoL2\n\trxA5qH/lg3kYg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=lNbYWqIOE0snoy8JD/M29tnOpeqF3MOlrdM7haYgrxg=;\n\tb=BIusIyRaMFkGALR5SjoN9MTqow63AnFJkZljND8JfF9KhGC9EdGEelvKjV41G5sFyK\n\t4bc1J9b6/CcmCLQpIJSLr6WqlcN/SC+tLxj8GJ2jgsnVUsFnPwQrXsGZOBCqNajp+i/0\n\tWBg3QAaXMn9AlVk7oRtkbnfhtH/cwJVIkIuC5qGEyIyybr8CTtPdiQlJHe3OuzyF7wqd\n\tiCPPbPfI6ZINOk6huY/Ikt4EilTRD336G7K7HIBCy7OHYUeWf4dl6vpk8ArFiFcQrJnH\n\tjQSTmPyZmvRwHURQ+sIZ7nqb/HeGkeO3uxUN9u/GZO+KRbHNrvKSdFucDC3xLZdGXN90\n\tj0Og=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"BIusIyRa\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=lNbYWqIOE0snoy8JD/M29tnOpeqF3MOlrdM7haYgrxg=;\n\tb=Sb8dg530UXR0om5Xf0a+yA5LxHAAtfXb4a/0DaKDxtuurZWbFEM6UeP9s3BEWlA5dN\n\tOxbIAljdCT0JG9QndaZ96UZrz/iYAMg20vRoE15T3qluqWCSVUjag8ZcTF2PIR25ho4u\n\twAuHGiT27jJpI7uWPCK6sd6NtRU9DafG19gdXApsYnf8l3FZetN01wmjlWvtkw6xYIES\n\t1edGWV9keTfKfjmf5naJIeKl2eCfmM/xQ4bqa/Nn8FgH1brdYO6oilGtKcCISnJO1CUm\n\teNL1JXHZEL9HmsbtKjpExWaRMrVgPUcmj9/ZhcASjokwYTs+q03i9dc6BqqwlxmOR8gK\n\tEr8g==","X-Gm-Message-State":"AJIora98z4xyOgPoRtrK3NGDrvqWM4VsTen/9S9GZ3vG3LeTkaPN5qRO\n\tmFy89DdNJ+tINXCB6cQDniBEi6pkwpbjUhwwabEfmQ==","X-Google-Smtp-Source":"AGRyM1tLWr+LGsmnvoCcmsr4wJ+0KNfUGduh99peIBAaCEitMY2ertrSLG8B5l8xTYMhBJ53vcf1do+vNRCh3Dn8iDc=","X-Received":"by 2002:a05:6512:3f14:b0:47d:e011:f19b with SMTP id\n\ty20-20020a0565123f1400b0047de011f19bmr4755744lfa.427.1655450701739;\n\tFri, 17 Jun 2022 00:25:01 -0700 (PDT)","MIME-Version":"1.0","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>","In-Reply-To":"<20220616110639.raznhr2mlu5czsgq@uno.localdomain>","Date":"Fri, 17 Jun 2022 09:24:50 +0200","Message-ID":"<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Daniel Semkowicz <dse@thaumatec.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23436,"web_url":"https://patchwork.libcamera.org/comment/23436/","msgid":"<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>","date":"2022-06-17T08:01:11","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Daniel,\n\nOn Fri, Jun 17, 2022 at 09:24:50AM +0200, Daniel Semkowicz wrote:\n> Hi Jacopo,\n>\n> On Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> >\n> > Hi Daniel,\n> >\n> >    I wonder if we shouldn't just drop the whole\n> >\n> > Start an event loop\n> > ~~~~~~~~~~~~~~~~~~~\n> >\n> > paragraph\n> >\n>\n> I was also thinking about that when I was editing the current text.\n> It is always the decision on how many details about the internal\n> architecture We want to present to the developer in this guide.\n> As it is the introduction guide then maybe indeed it will be better to\n> keep it simple and do not talk too much about the internals.\n>\n> There will still be this one \"sleep_for(3000ms)\" line needed and I think\n> it would be good to leave some short explanation why it is here. Do you\n> think that adding it at the end of \"Request queueing\" section is a good\n> idea or should I create a separate section about it?\n\nYou're right, throwing a sleep_for() without saying anything might be\nnot the best idea :)\n\nLet's resume your original proposal and let me try to integrate it\nwith a full rewrite of the paragraph.\n\n>\n> > > -Start an event loop\n> > > +Event loop\n> > >  ~~~~~~~~~~~~~~~~~~~\n> > >\n> > >  The libcamera library needs an event loop to monitor and dispatch events\n> > > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> > >  notifiers' signals and emit application visible events, such as the\n> > >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> > >\n> > > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > > -system.\n> > > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > > +loop processing.\n\nEvent loop\n~~~~~~~~~~~~~~~~~~~\n\nThe libcamera library needs an event loop to monitor and dispatch\nevents generated by the video devices part of the capture pipeline.\nlibcamera runs its own event loop in a separate thread, created at\n``CameraManager::start()_`` time. This means applications will run in\ntheir own thread and need to manage their own execution opportunely,\nto respond to user generate events and to libcamera generated events\nemitted through signals.\n\nReal-world applications will likely either integrate in the event loop\nof higher level frameworks or create their own one to respond to user\ngenerated events, while for the simple application presented in this\nexample it is enough to prevent immediate termination by pausing for 3\nseconds, during which the asynchronous request completion events\ngenerated by libcamera will be handled by the ``requestComplete()``\nslot connected to the ``Camera::requestCompleted`` signal.\n\n.. code:: cpp\n\n   std::this_thread::sleep_for(3000ms);\n\nWhat do you think ?\n\n> > > +\n> > > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > > +the immediate termination of the application. The code below pauses the main\n> > > +thread for 3 seconds, so that the event loop thread can process the requests.\n> > >\n> > >  .. code:: cpp\n> > >\n> > > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > > -   Timer timer;\n> > > -   timer.start(3000);\n> > > -   while (timer.isRunning())\n> > > -       dispatcher->processEvents();\n> > > +   std::this_thread::sleep_for(3000ms);\n> > >\n> > >  Clean up and stop the application\n> > >  ---------------------------------\n> > > --\n> > > 2.34.1\n> > >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7F4FFBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 08:01:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CCAFD65635;\n\tFri, 17 Jun 2022 10:01:14 +0200 (CEST)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 925E060471\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 10:01:13 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 25291E0016;\n\tFri, 17 Jun 2022 08:01:12 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655452874;\n\tbh=iKmJQH9G3WQixI/9MkF7TguLohmF+uUffVRL07jiMmQ=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=uvGskMZFF+s8kJZcpNlcIpSh8bS68FEKfmO/P341Cf+YAalm3o4XXAwJyqYEmkEmD\n\tGtueBO9HaKg3tpds+0iwmOGjL0xKirt/vC1nRYIM+QRB1jGG3btHrmb5FAcfQPSF8I\n\tn1ed1qgw9h7ypAGpO9pPDPr8yVJFONiuFn/siNaK9cK9/HsZB48YI5VDJ4g4XHWih4\n\tJVF1JJva7IhgcartFpph9uUGL1z/nzHH8CMy/+HSL3Z/DGeDvor6KlC7tRfS5h1ZU8\n\t/0vM3+ZxFWGro6HkGSrQQLoeJeZDG8gPcHODLm09HywBHvOfzBKBDSMkkOnuNeGFwv\n\tIb6wwyg8ckYbw==","Date":"Fri, 17 Jun 2022 10:01:11 +0200","To":"Daniel Semkowicz <dse@thaumatec.com>","Message-ID":"<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>\n\t<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23439,"web_url":"https://patchwork.libcamera.org/comment/23439/","msgid":"<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>","date":"2022-06-17T09:28:19","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":126,"url":"https://patchwork.libcamera.org/api/people/126/","name":"Daniel Semkowicz","email":"dse@thaumatec.com"},"content":"The description sounds clear. I would just add minor changes.\n\nOn Fri, Jun 17, 2022 at 10:01 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> Hi Daniel,\n>\n> On Fri, Jun 17, 2022 at 09:24:50AM +0200, Daniel Semkowicz wrote:\n> > Hi Jacopo,\n> >\n> > On Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > >\n> > > Hi Daniel,\n> > >\n> > >    I wonder if we shouldn't just drop the whole\n> > >\n> > > Start an event loop\n> > > ~~~~~~~~~~~~~~~~~~~\n> > >\n> > > paragraph\n> > >\n> >\n> > I was also thinking about that when I was editing the current text.\n> > It is always the decision on how many details about the internal\n> > architecture We want to present to the developer in this guide.\n> > As it is the introduction guide then maybe indeed it will be better to\n> > keep it simple and do not talk too much about the internals.\n> >\n> > There will still be this one \"sleep_for(3000ms)\" line needed and I think\n> > it would be good to leave some short explanation why it is here. Do you\n> > think that adding it at the end of \"Request queueing\" section is a good\n> > idea or should I create a separate section about it?\n>\n> You're right, throwing a sleep_for() without saying anything might be\n> not the best idea :)\n>\n> Let's resume your original proposal and let me try to integrate it\n> with a full rewrite of the paragraph.\n>\n> >\n> > > > -Start an event loop\n> > > > +Event loop\n> > > >  ~~~~~~~~~~~~~~~~~~~\n> > > >\n> > > >  The libcamera library needs an event loop to monitor and dispatch events\n> > > > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> > > >  notifiers' signals and emit application visible events, such as the\n> > > >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> > > >\n> > > > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > > > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > > > -system.\n> > > > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > > > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > > > +loop processing.\n>\n> Event loop\n> ~~~~~~~~~~~~~~~~~~~\n>\n> The libcamera library needs an event loop to monitor and dispatch\n> events generated by the video devices part of the capture pipeline.\n> libcamera runs its own event loop in a separate thread, created at\n> ``CameraManager::start()_`` time. This means applications will run in\n> their own thread and need to manage their own execution opportunely,\n> to respond to user generate events and to libcamera generated events\n> emitted through signals.\n\ntypo: \"user generate\" -> \"user generated\"\n\n>\n> Real-world applications will likely either integrate in the event loop\n> of higher level frameworks or create their own one to respond to user\n> generated events, while for the simple application presented in this\n> example it is enough to prevent immediate termination by pausing for 3\n> seconds, during which the asynchronous request completion events\n> generated by libcamera will be handled by the ``requestComplete()``\n> slot connected to the ``Camera::requestCompleted`` signal.\n\nI would break down this part into less complex sentences to improve\nreadability. Something like:\n\nReal-world applications will likely either integrate in the event loop\nof higher level frameworks or create their own one to respond to user\ngenerated events. For the simple application presented in this example,\nit is enough to prevent immediate termination by pausing for 3 seconds.\nDuring this time, the asynchronous request completion events generated\nby libcamera will be handled by the ``requestComplete()`` slot connected\nto the ``Camera::requestCompleted`` signal.\n\nIs it ok?\n\nBest regards\nDaniel\n\n>\n> .. code:: cpp\n>\n>    std::this_thread::sleep_for(3000ms);\n>\n> What do you think ?\n>\n> > > > +\n> > > > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > > > +the immediate termination of the application. The code below pauses the main\n> > > > +thread for 3 seconds, so that the event loop thread can process the requests.\n> > > >\n> > > >  .. code:: cpp\n> > > >\n> > > > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > > > -   Timer timer;\n> > > > -   timer.start(3000);\n> > > > -   while (timer.isRunning())\n> > > > -       dispatcher->processEvents();\n> > > > +   std::this_thread::sleep_for(3000ms);\n> > > >\n> > > >  Clean up and stop the application\n> > > >  ---------------------------------\n> > > > --\n> > > > 2.34.1\n> > > >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F3D45BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 09:28:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4C33E65636;\n\tFri, 17 Jun 2022 11:28:32 +0200 (CEST)","from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com\n\t[IPv6:2a00:1450:4864:20::12c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 70A8260471\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 11:28:31 +0200 (CEST)","by mail-lf1-x12c.google.com with SMTP id a2so6066552lfg.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 02:28:31 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655458112;\n\tbh=dhU8h0F8ZVQavLY+E1oxYAQeBD+R0r78L2/nIGgNMbA=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=xGzd/BcXDwnKEXvFZ5FBZJH33RPwx9zM+T0f4Q0ymv1DWWKYt8y4f5lK5U+Fez5VL\n\taV0dEi5EIznwrN3IxTkeWL34CZbp7nwETC+WdQWLUoaz54MeOOMy1nwE3UdifeD8Kr\n\tBYMQk1zv7jjVCMGhVth8eSWZus7nvsL/FReR7oq8k6LrwBodo3ZVuAT1e+fmbqxjDJ\n\tdEVBYVBreGf8P5P8dXgh8JJk5zwCh3zKTF1qqA7gjGGXNsYuCmNEutG3IsUdo1I0oL\n\tWDLPCjvX+xgZCEduqtsGi1MY2PNBBIzbRI5x4IPupo3aIx2VIZk0KNvapK7G6Wfonb\n\tBf26YGHLFM9Ng==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=YslgKyLJRXD+bmfhNm2/GmVqru9UmO1NYVg6AtFMpF4=;\n\tb=os2WaXOyNEg3GcFf1z5Zqv9/dzroSdZ4ZYB2hWk52Exs2CzOjf2rK52EJCPWb4eAzF\n\t80UXtttZn+5gHfAsE8dHQmLAL7N+93YzXfzubQ92KFh7BlPEW8FD0funbKJE48gPINpI\n\t+GG+NKb6/gG6f6LG0GFjQvJJm6Z9GqQ490FuFffA89Lhq/DJVe0WHGbBTj1tFjzcnIsW\n\tdpeEK8ZaeY/3rl6q6cEwwePCrFlaGCgCxFEM0SRe9RaKyVVrNqBvwD3QzjgidBc1URKr\n\thO3LXCPu0bFZHq02ietSE4pc1cwHA25lO1Vj9vSoEx3ExP7xXVZXcIYufyF+ygeIYyV+\n\tw4hQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"os2WaXOy\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=YslgKyLJRXD+bmfhNm2/GmVqru9UmO1NYVg6AtFMpF4=;\n\tb=CYG/cTsGuFBcVh8B91NLota/FFuRfc6bIqzTBDOCJrMk+wvyl15c2iM5Ci+JtlUtDn\n\tvwMmh3yjNC/VdmiAUfjed53Yd0LTcRfX2hx5qzA3K7LeBDgA1BW5VpTVJlaR++0Mmcox\n\tbvUCWrfDLbk1lEjNq7ugD7B4/XOXg1jx/wgLAEByrUakzqe+TwV1edt0iSgbi8lIaqdQ\n\taybBfR++3JDGbZ3oP7LWRJsUvx0TX36zX+z++dVkcEvR2Dlf7986qsJ3F0NmFLk4B68B\n\tXzUTBeuSlYyyrZKCZvBbTA7VuyJxJq59ZNXtVUO8dJAdjxvwZTJPzcjtzUsI7fFKfJmJ\n\t/fvA==","X-Gm-Message-State":"AJIora9ZaTDYC1UR6HJ7KB4ExdnGDDDpP3ODfSmypBM1st5qmL/rHiN4\n\tnrYXLrBnM6ey34sr8SKK+F6OviqDFIPbUG6LtO5Pcw==","X-Google-Smtp-Source":"AGRyM1uERVCfEw7DxyYmBwM+auoTXOpRM66dh95faUQG70IpXb0pWIKsRyvcCl+5bL2iEXuTEQvBeDPbShqvbolE+Rs=","X-Received":"by 2002:a19:c213:0:b0:478:f00b:3d46 with SMTP id\n\tl19-20020a19c213000000b00478f00b3d46mr5218066lfc.394.1655458110760;\n\tFri, 17 Jun 2022 02:28:30 -0700 (PDT)","MIME-Version":"1.0","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>\n\t<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>\n\t<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>","In-Reply-To":"<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>","Date":"Fri, 17 Jun 2022 11:28:19 +0200","Message-ID":"<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Daniel Semkowicz <dse@thaumatec.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23440,"web_url":"https://patchwork.libcamera.org/comment/23440/","msgid":"<20220617093945.rwlbsvhotwshm6bz@uno.localdomain>","date":"2022-06-17T09:39:45","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Daniel,\n\nOn Fri, Jun 17, 2022 at 11:28:19AM +0200, Daniel Semkowicz wrote:\n> The description sounds clear. I would just add minor changes.\n>\n> On Fri, Jun 17, 2022 at 10:01 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> >\n> > Hi Daniel,\n> >\n> > On Fri, Jun 17, 2022 at 09:24:50AM +0200, Daniel Semkowicz wrote:\n> > > Hi Jacopo,\n> > >\n> > > On Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > >\n> > > > Hi Daniel,\n> > > >\n> > > >    I wonder if we shouldn't just drop the whole\n> > > >\n> > > > Start an event loop\n> > > > ~~~~~~~~~~~~~~~~~~~\n> > > >\n> > > > paragraph\n> > > >\n> > >\n> > > I was also thinking about that when I was editing the current text.\n> > > It is always the decision on how many details about the internal\n> > > architecture We want to present to the developer in this guide.\n> > > As it is the introduction guide then maybe indeed it will be better to\n> > > keep it simple and do not talk too much about the internals.\n> > >\n> > > There will still be this one \"sleep_for(3000ms)\" line needed and I think\n> > > it would be good to leave some short explanation why it is here. Do you\n> > > think that adding it at the end of \"Request queueing\" section is a good\n> > > idea or should I create a separate section about it?\n> >\n> > You're right, throwing a sleep_for() without saying anything might be\n> > not the best idea :)\n> >\n> > Let's resume your original proposal and let me try to integrate it\n> > with a full rewrite of the paragraph.\n> >\n> > >\n> > > > > -Start an event loop\n> > > > > +Event loop\n> > > > >  ~~~~~~~~~~~~~~~~~~~\n> > > > >\n> > > > >  The libcamera library needs an event loop to monitor and dispatch events\n> > > > > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> > > > >  notifiers' signals and emit application visible events, such as the\n> > > > >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> > > > >\n> > > > > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > > > > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > > > > -system.\n> > > > > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > > > > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > > > > +loop processing.\n> >\n> > Event loop\n> > ~~~~~~~~~~~~~~~~~~~\n> >\n> > The libcamera library needs an event loop to monitor and dispatch\n> > events generated by the video devices part of the capture pipeline.\n> > libcamera runs its own event loop in a separate thread, created at\n> > ``CameraManager::start()_`` time. This means applications will run in\n> > their own thread and need to manage their own execution opportunely,\n> > to respond to user generate events and to libcamera generated events\n> > emitted through signals.\n>\n> typo: \"user generate\" -> \"user generated\"\n>\n> >\n> > Real-world applications will likely either integrate in the event loop\n> > of higher level frameworks or create their own one to respond to user\n> > generated events, while for the simple application presented in this\n> > example it is enough to prevent immediate termination by pausing for 3\n> > seconds, during which the asynchronous request completion events\n> > generated by libcamera will be handled by the ``requestComplete()``\n> > slot connected to the ``Camera::requestCompleted`` signal.\n>\n> I would break down this part into less complex sentences to improve\n> readability. Something like:\n>\n> Real-world applications will likely either integrate in the event loop\n> of higher level frameworks or create their own one to respond to user\n> generated events. For the simple application presented in this example,\n> it is enough to prevent immediate termination by pausing for 3 seconds.\n> During this time, the asynchronous request completion events generated\n> by libcamera will be handled by the ``requestComplete()`` slot connected\n> to the ``Camera::requestCompleted`` signal.\n>\n> Is it ok?\n\nThanks, much better!\n\nThanks\n   j\n\n>\n> Best regards\n> Daniel\n>\n> >\n> > .. code:: cpp\n> >\n> >    std::this_thread::sleep_for(3000ms);\n> >\n> > What do you think ?\n> >\n> > > > > +\n> > > > > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > > > > +the immediate termination of the application. The code below pauses the main\n> > > > > +thread for 3 seconds, so that the event loop thread can process the requests.\n> > > > >\n> > > > >  .. code:: cpp\n> > > > >\n> > > > > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > > > > -   Timer timer;\n> > > > > -   timer.start(3000);\n> > > > > -   while (timer.isRunning())\n> > > > > -       dispatcher->processEvents();\n> > > > > +   std::this_thread::sleep_for(3000ms);\n> > > > >\n> > > > >  Clean up and stop the application\n> > > > >  ---------------------------------\n> > > > > --\n> > > > > 2.34.1\n> > > > >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B48F9BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 09:39:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 075A565634;\n\tFri, 17 Jun 2022 11:39:49 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 973B5633A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 11:39:47 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 121BE240006;\n\tFri, 17 Jun 2022 09:39:46 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655458789;\n\tbh=4u9MSDO0fO9hasxu5GaPaVHjQJ3dyU1bizDyhU3uyvA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=RqFko+GtVG8V1MLW1Wwx6jsV6cwnx8fjCmUOZXRr4ZNTNzboLBmqWkRYZFwozRPkq\n\tMFcJFa2r6TbRQtketRKIa8+kBQN3VgBkOqXZy6/gc6qYcIM1vHKh+LdRVGX7/fmCLL\n\tFkMySpHPTac5NnDI3w04gRFqo1xyM312wuHY6RbxdAaX/wKsIFkiwTfOzxwa363fsK\n\tNMVJjbaaoldr3mOVjCqYKCMwsIjvSna0n9GpPnybffOiwCI9x+n8tZKF/DnhBlR037\n\t9nZX55HhZ7J+CV5SFPyeSD+PyjImQNJ2dbE4qmdm9CA37sc8BV0VlaTaHm6Ag9V9h/\n\tDHtjsz/FGXy5w==","Date":"Fri, 17 Jun 2022 11:39:45 +0200","To":"Daniel Semkowicz <dse@thaumatec.com>","Message-ID":"<20220617093945.rwlbsvhotwshm6bz@uno.localdomain>","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>\n\t<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>\n\t<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>\n\t<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23444,"web_url":"https://patchwork.libcamera.org/comment/23444/","msgid":"<YqxoD76NzQVRKj2l@pendragon.ideasonboard.com>","date":"2022-06-17T11:39:59","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello,\n\nOn Fri, Jun 17, 2022 at 11:39:45AM +0200, Jacopo Mondi via libcamera-devel wrote:\n> On Fri, Jun 17, 2022 at 11:28:19AM +0200, Daniel Semkowicz wrote:\n> > The description sounds clear. I would just add minor changes.\n> >\n> > On Fri, Jun 17, 2022 at 10:01 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > On Fri, Jun 17, 2022 at 09:24:50AM +0200, Daniel Semkowicz wrote:\n> > > > On Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > > >\n> > > > > Hi Daniel,\n> > > > >\n> > > > >    I wonder if we shouldn't just drop the whole\n> > > > >\n> > > > > Start an event loop\n> > > > > ~~~~~~~~~~~~~~~~~~~\n> > > > >\n> > > > > paragraph\n> > > >\n> > > > I was also thinking about that when I was editing the current text.\n> > > > It is always the decision on how many details about the internal\n> > > > architecture We want to present to the developer in this guide.\n> > > > As it is the introduction guide then maybe indeed it will be better to\n> > > > keep it simple and do not talk too much about the internals.\n> > > >\n> > > > There will still be this one \"sleep_for(3000ms)\" line needed and I think\n> > > > it would be good to leave some short explanation why it is here. Do you\n> > > > think that adding it at the end of \"Request queueing\" section is a good\n> > > > idea or should I create a separate section about it?\n> > >\n> > > You're right, throwing a sleep_for() without saying anything might be\n> > > not the best idea :)\n> > >\n> > > Let's resume your original proposal and let me try to integrate it\n> > > with a full rewrite of the paragraph.\n> > >\n> > > > > > -Start an event loop\n> > > > > > +Event loop\n> > > > > >  ~~~~~~~~~~~~~~~~~~~\n> > > > > >\n> > > > > >  The libcamera library needs an event loop to monitor and dispatch events\n> > > > > > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> > > > > >  notifiers' signals and emit application visible events, such as the\n> > > > > >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> > > > > >\n> > > > > > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > > > > > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > > > > > -system.\n> > > > > > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > > > > > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > > > > > +loop processing.\n> > >\n> > > Event loop\n> > > ~~~~~~~~~~~~~~~~~~~\n\nNitpicking, the underline should be shortened.\n\n> > >\n> > > The libcamera library needs an event loop to monitor and dispatch\n> > > events generated by the video devices part of the capture pipeline.\n> > > libcamera runs its own event loop in a separate thread, created at\n> > > ``CameraManager::start()_`` time. This means applications will run in\n> > > their own thread and need to manage their own execution opportunely,\n> > > to respond to user generate events and to libcamera generated events\n> > > emitted through signals.\n> >\n> > typo: \"user generate\" -> \"user generated\"\n\nOr even \"user-generated\" I think.\n\nI'd write this a bit differently to avoid mentioning the internal event\nloop as such. How about the following ?\n\nlibcamera creates an internal execution thread at '`CameraManager::start()_``\ntime to decouple its own event processing from the application's main thread.\nApplications are thus free to manage their own execution opportunely, and only\nneed to respond to events generated by libcamera emitted through signals.\n\nReal-world applications will likely either integrate with the event loop of the\nframework they use, or create their own event loop to respond to user events.\nFor the simple application presented in this example, it is enough to prevent\nimmediate termination by pausing for 3 seconds. During that time, the libcamera\nthread will generate request completion events that the application will handle\nin the ``requestComplete()`` slot connected to the ``Camera::requestCompleted``\nsignal.\n\n> > > Real-world applications will likely either integrate in the event loop\n> > > of higher level frameworks or create their own one to respond to user\n> > > generated events, while for the simple application presented in this\n> > > example it is enough to prevent immediate termination by pausing for 3\n> > > seconds, during which the asynchronous request completion events\n> > > generated by libcamera will be handled by the ``requestComplete()``\n> > > slot connected to the ``Camera::requestCompleted`` signal.\n> >\n> > I would break down this part into less complex sentences to improve\n> > readability. Something like:\n> >\n> > Real-world applications will likely either integrate in the event loop\n> > of higher level frameworks or create their own one to respond to user\n> > generated events. For the simple application presented in this example,\n> > it is enough to prevent immediate termination by pausing for 3 seconds.\n> > During this time, the asynchronous request completion events generated\n> > by libcamera will be handled by the ``requestComplete()`` slot connected\n> > to the ``Camera::requestCompleted`` signal.\n> >\n> > Is it ok?\n> \n> Thanks, much better!\n> \n> > > .. code:: cpp\n> > >\n> > >    std::this_thread::sleep_for(3000ms);\n> > >\n> > > What do you think ?\n> > >\n> > > > > > +\n> > > > > > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > > > > > +the immediate termination of the application. The code below pauses the main\n> > > > > > +thread for 3 seconds, so that the event loop thread can process the requests.\n> > > > > >\n> > > > > >  .. code:: cpp\n> > > > > >\n> > > > > > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > > > > > -   Timer timer;\n> > > > > > -   timer.start(3000);\n> > > > > > -   while (timer.isRunning())\n> > > > > > -       dispatcher->processEvents();\n> > > > > > +   std::this_thread::sleep_for(3000ms);\n> > > > > >\n> > > > > >  Clean up and stop the application\n> > > > > >  ---------------------------------","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4C422BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 11:40:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9CC5665632;\n\tFri, 17 Jun 2022 13:40:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4ABE865632\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 13:40:11 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7CE28268;\n\tFri, 17 Jun 2022 13:40:10 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655466012;\n\tbh=PHRwDW2Cj1TmQv901TCufdRoMQHsBOfnleRKV5FK4T8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=jczxIFe1kdsyOpeKFH82yZ6kiBBHK/Sc8k8E1dTyrWQD3Y+UIR9LAfIHKe7dfa6pQ\n\t/0iDAdeowgHpRNK03M37dRtK4wvQ/jiOGovNzj8/dU2FV9rhhYiAHcQjfWBFEpFAYB\n\t0/1f3MCbhQUhNsL5Hx3UjTyUDLxBNvLVyjkwvYCiPItiPD3BTzNw6NRgmfYU+gQzye\n\tkiSQnxkVuwx0pevRZ6bVUMrll8tm6+7aAqz+G9coeED5FAL1i6OStLkR9Mlo3mbkws\n\tnbVKAs8/IlGKjMO/BfutTI9QJUI5p7J/lMuJEQsIhO6x9y5+LoZ3XC/+buSypDAWN/\n\tRFV+VPVQCZ4sQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655466010;\n\tbh=PHRwDW2Cj1TmQv901TCufdRoMQHsBOfnleRKV5FK4T8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GQNHySraZADAS1wuU7UdHI+XLW7kovdpvQSHWsj3YafxLM+g5tWwc/ayMZLvA7chS\n\tev0S4gO/lN7J+pPzQd2DSLykp93Gaxo2OEYogJ/6A4JS//D/jy1yrMqNd441CcXEUt\n\tXCwZztk/0xk8ImbRTYLuofn69O6d9ibe9q5Mak0c="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"GQNHySra\"; dkim-atps=neutral","Date":"Fri, 17 Jun 2022 14:39:59 +0300","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YqxoD76NzQVRKj2l@pendragon.ideasonboard.com>","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>\n\t<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>\n\t<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>\n\t<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>\n\t<20220617093945.rwlbsvhotwshm6bz@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220617093945.rwlbsvhotwshm6bz@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23445,"web_url":"https://patchwork.libcamera.org/comment/23445/","msgid":"<20220617122258.owpmq3wx4ueukfrj@uno.localdomain>","date":"2022-06-17T12:22:58","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Fri, Jun 17, 2022 at 02:39:59PM +0300, Laurent Pinchart wrote:\n> Hello,\n>\n> On Fri, Jun 17, 2022 at 11:39:45AM +0200, Jacopo Mondi via libcamera-devel wrote:\n> > On Fri, Jun 17, 2022 at 11:28:19AM +0200, Daniel Semkowicz wrote:\n> > > The description sounds clear. I would just add minor changes.\n> > >\n> > > On Fri, Jun 17, 2022 at 10:01 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > > On Fri, Jun 17, 2022 at 09:24:50AM +0200, Daniel Semkowicz wrote:\n> > > > > On Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > > > >\n> > > > > > Hi Daniel,\n> > > > > >\n> > > > > >    I wonder if we shouldn't just drop the whole\n> > > > > >\n> > > > > > Start an event loop\n> > > > > > ~~~~~~~~~~~~~~~~~~~\n> > > > > >\n> > > > > > paragraph\n> > > > >\n> > > > > I was also thinking about that when I was editing the current text.\n> > > > > It is always the decision on how many details about the internal\n> > > > > architecture We want to present to the developer in this guide.\n> > > > > As it is the introduction guide then maybe indeed it will be better to\n> > > > > keep it simple and do not talk too much about the internals.\n> > > > >\n> > > > > There will still be this one \"sleep_for(3000ms)\" line needed and I think\n> > > > > it would be good to leave some short explanation why it is here. Do you\n> > > > > think that adding it at the end of \"Request queueing\" section is a good\n> > > > > idea or should I create a separate section about it?\n> > > >\n> > > > You're right, throwing a sleep_for() without saying anything might be\n> > > > not the best idea :)\n> > > >\n> > > > Let's resume your original proposal and let me try to integrate it\n> > > > with a full rewrite of the paragraph.\n> > > >\n> > > > > > > -Start an event loop\n> > > > > > > +Event loop\n> > > > > > >  ~~~~~~~~~~~~~~~~~~~\n> > > > > > >\n> > > > > > >  The libcamera library needs an event loop to monitor and dispatch events\n> > > > > > > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> > > > > > >  notifiers' signals and emit application visible events, such as the\n> > > > > > >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> > > > > > >\n> > > > > > > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > > > > > > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > > > > > > -system.\n> > > > > > > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > > > > > > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > > > > > > +loop processing.\n> > > >\n> > > > Event loop\n> > > > ~~~~~~~~~~~~~~~~~~~\n>\n> Nitpicking, the underline should be shortened.\n>\n> > > >\n> > > > The libcamera library needs an event loop to monitor and dispatch\n> > > > events generated by the video devices part of the capture pipeline.\n> > > > libcamera runs its own event loop in a separate thread, created at\n> > > > ``CameraManager::start()_`` time. This means applications will run in\n> > > > their own thread and need to manage their own execution opportunely,\n> > > > to respond to user generate events and to libcamera generated events\n> > > > emitted through signals.\n> > >\n> > > typo: \"user generate\" -> \"user generated\"\n>\n> Or even \"user-generated\" I think.\n>\n> I'd write this a bit differently to avoid mentioning the internal event\n> loop as such. How about the following ?\n>\n> libcamera creates an internal execution thread at '`CameraManager::start()_``\n> time to decouple its own event processing from the application's main thread.\n> Applications are thus free to manage their own execution opportunely, and only\n> need to respond to events generated by libcamera emitted through signals.\n>\n> Real-world applications will likely either integrate with the event loop of the\n> framework they use, or create their own event loop to respond to user events.\n> For the simple application presented in this example, it is enough to prevent\n> immediate termination by pausing for 3 seconds. During that time, the libcamera\n> thread will generate request completion events that the application will handle\n> in the ``requestComplete()`` slot connected to the ``Camera::requestCompleted``\n> signal.\n>\n\nGood, works for me!\n\n> > > > Real-world applications will likely either integrate in the event loop\n> > > > of higher level frameworks or create their own one to respond to user\n> > > > generated events, while for the simple application presented in this\n> > > > example it is enough to prevent immediate termination by pausing for 3\n> > > > seconds, during which the asynchronous request completion events\n> > > > generated by libcamera will be handled by the ``requestComplete()``\n> > > > slot connected to the ``Camera::requestCompleted`` signal.\n> > >\n> > > I would break down this part into less complex sentences to improve\n> > > readability. Something like:\n> > >\n> > > Real-world applications will likely either integrate in the event loop\n> > > of higher level frameworks or create their own one to respond to user\n> > > generated events. For the simple application presented in this example,\n> > > it is enough to prevent immediate termination by pausing for 3 seconds.\n> > > During this time, the asynchronous request completion events generated\n> > > by libcamera will be handled by the ``requestComplete()`` slot connected\n> > > to the ``Camera::requestCompleted`` signal.\n> > >\n> > > Is it ok?\n> >\n> > Thanks, much better!\n> >\n> > > > .. code:: cpp\n> > > >\n> > > >    std::this_thread::sleep_for(3000ms);\n> > > >\n> > > > What do you think ?\n> > > >\n> > > > > > > +\n> > > > > > > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > > > > > > +the immediate termination of the application. The code below pauses the main\n> > > > > > > +thread for 3 seconds, so that the event loop thread can process the requests.\n> > > > > > >\n> > > > > > >  .. code:: cpp\n> > > > > > >\n> > > > > > > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > > > > > > -   Timer timer;\n> > > > > > > -   timer.start(3000);\n> > > > > > > -   while (timer.isRunning())\n> > > > > > > -       dispatcher->processEvents();\n> > > > > > > +   std::this_thread::sleep_for(3000ms);\n> > > > > > >\n> > > > > > >  Clean up and stop the application\n> > > > > > >  ---------------------------------\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D1F58BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 12:23:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 23F2165637;\n\tFri, 17 Jun 2022 14:23:02 +0200 (CEST)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 58D0C65632\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 14:23:01 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 8BBC520003;\n\tFri, 17 Jun 2022 12:23:00 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655468582;\n\tbh=GDLf9TOQzUhCqk1T+IrmpwXeFvG7YLZw3eaO+puaLYk=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=vT8KnocI9gkkXjrvUwxz2ME1x/1NiMgdbvsuVbSFNNDqIusLVIjxgnEqnkOJVsdoB\n\t1Lk8tRB1lzxb0El0ZV76+/Jldw/LpisRkLhis0gRAqFit0OAcj6dBxGxLJNNUg2QX6\n\taikMIQAuViLvufTAbu656wcmNx2ED7NB+ld6EU/+e9Lw6J1bUxGhi72RPqhKuUppss\n\tAf5VGHrKWT7p3FYv81sBxGsd1PDu6TwBHwFoickue0NWn+LL+FV0DpmhINh1jUeUhB\n\tVv73MGkMzuhLdz5BhXEedHpr9LpZikkO74zGxVmUGZZjaeBuVMJlFDUfDECKQYONu0\n\tlo5COH3rT2NZQ==","Date":"Fri, 17 Jun 2022 14:22:58 +0200","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220617122258.owpmq3wx4ueukfrj@uno.localdomain>","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>\n\t<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>\n\t<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>\n\t<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>\n\t<20220617093945.rwlbsvhotwshm6bz@uno.localdomain>\n\t<YqxoD76NzQVRKj2l@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<YqxoD76NzQVRKj2l@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23451,"web_url":"https://patchwork.libcamera.org/comment/23451/","msgid":"<CAHgnY3=Ro2=iLneDEcn6S_Afbz8p09cBDB7NBEq6n=SsdA=29w@mail.gmail.com>","date":"2022-06-17T13:53:41","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":126,"url":"https://patchwork.libcamera.org/api/people/126/","name":"Daniel Semkowicz","email":"dse@thaumatec.com"},"content":"Hi Laurent,\n\nOn Fri, Jun 17, 2022 at 2:23 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> Hi Laurent\n>\n> On Fri, Jun 17, 2022 at 02:39:59PM +0300, Laurent Pinchart wrote:\n> > Hello,\n> >\n> > On Fri, Jun 17, 2022 at 11:39:45AM +0200, Jacopo Mondi via libcamera-devel wrote:\n> > > On Fri, Jun 17, 2022 at 11:28:19AM +0200, Daniel Semkowicz wrote:\n> > > > The description sounds clear. I would just add minor changes.\n> > > >\n> > > > On Fri, Jun 17, 2022 at 10:01 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > > > On Fri, Jun 17, 2022 at 09:24:50AM +0200, Daniel Semkowicz wrote:\n> > > > > > On Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > > > > >\n> > > > > > > Hi Daniel,\n> > > > > > >\n> > > > > > >    I wonder if we shouldn't just drop the whole\n> > > > > > >\n> > > > > > > Start an event loop\n> > > > > > > ~~~~~~~~~~~~~~~~~~~\n> > > > > > >\n> > > > > > > paragraph\n> > > > > >\n> > > > > > I was also thinking about that when I was editing the current text.\n> > > > > > It is always the decision on how many details about the internal\n> > > > > > architecture We want to present to the developer in this guide.\n> > > > > > As it is the introduction guide then maybe indeed it will be better to\n> > > > > > keep it simple and do not talk too much about the internals.\n> > > > > >\n> > > > > > There will still be this one \"sleep_for(3000ms)\" line needed and I think\n> > > > > > it would be good to leave some short explanation why it is here. Do you\n> > > > > > think that adding it at the end of \"Request queueing\" section is a good\n> > > > > > idea or should I create a separate section about it?\n> > > > >\n> > > > > You're right, throwing a sleep_for() without saying anything might be\n> > > > > not the best idea :)\n> > > > >\n> > > > > Let's resume your original proposal and let me try to integrate it\n> > > > > with a full rewrite of the paragraph.\n> > > > >\n> > > > > > > > -Start an event loop\n> > > > > > > > +Event loop\n> > > > > > > >  ~~~~~~~~~~~~~~~~~~~\n> > > > > > > >\n> > > > > > > >  The libcamera library needs an event loop to monitor and dispatch events\n> > > > > > > > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> > > > > > > >  notifiers' signals and emit application visible events, such as the\n> > > > > > > >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> > > > > > > >\n> > > > > > > > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > > > > > > > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > > > > > > > -system.\n> > > > > > > > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > > > > > > > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > > > > > > > +loop processing.\n> > > > >\n> > > > > Event loop\n> > > > > ~~~~~~~~~~~~~~~~~~~\n> >\n> > Nitpicking, the underline should be shortened.\n> >\n> > > > >\n> > > > > The libcamera library needs an event loop to monitor and dispatch\n> > > > > events generated by the video devices part of the capture pipeline.\n> > > > > libcamera runs its own event loop in a separate thread, created at\n> > > > > ``CameraManager::start()_`` time. This means applications will run in\n> > > > > their own thread and need to manage their own execution opportunely,\n> > > > > to respond to user generate events and to libcamera generated events\n> > > > > emitted through signals.\n> > > >\n> > > > typo: \"user generate\" -> \"user generated\"\n> >\n> > Or even \"user-generated\" I think.\n> >\n> > I'd write this a bit differently to avoid mentioning the internal event\n> > loop as such. How about the following ?\n> >\n> > libcamera creates an internal execution thread at '`CameraManager::start()_``\n> > time to decouple its own event processing from the application's main thread.\n> > Applications are thus free to manage their own execution opportunely, and only\n> > need to respond to events generated by libcamera emitted through signals.\n> >\n> > Real-world applications will likely either integrate with the event loop of the\n> > framework they use, or create their own event loop to respond to user events.\n> > For the simple application presented in this example, it is enough to prevent\n> > immediate termination by pausing for 3 seconds. During that time, the libcamera\n> > thread will generate request completion events that the application will handle\n> > in the ``requestComplete()`` slot connected to the ``Camera::requestCompleted``\n> > signal.\n> >\n\nThen do We want to leave section name as \"Event loop\" or also change\nit to something more general?\n\nBest regards\n\nDaniel\n\n\n>\n> Good, works for me!\n>\n> > > > > Real-world applications will likely either integrate in the event loop\n> > > > > of higher level frameworks or create their own one to respond to user\n> > > > > generated events, while for the simple application presented in this\n> > > > > example it is enough to prevent immediate termination by pausing for 3\n> > > > > seconds, during which the asynchronous request completion events\n> > > > > generated by libcamera will be handled by the ``requestComplete()``\n> > > > > slot connected to the ``Camera::requestCompleted`` signal.\n> > > >\n> > > > I would break down this part into less complex sentences to improve\n> > > > readability. Something like:\n> > > >\n> > > > Real-world applications will likely either integrate in the event loop\n> > > > of higher level frameworks or create their own one to respond to user\n> > > > generated events. For the simple application presented in this example,\n> > > > it is enough to prevent immediate termination by pausing for 3 seconds.\n> > > > During this time, the asynchronous request completion events generated\n> > > > by libcamera will be handled by the ``requestComplete()`` slot connected\n> > > > to the ``Camera::requestCompleted`` signal.\n> > > >\n> > > > Is it ok?\n> > >\n> > > Thanks, much better!\n> > >\n> > > > > .. code:: cpp\n> > > > >\n> > > > >    std::this_thread::sleep_for(3000ms);\n> > > > >\n> > > > > What do you think ?\n> > > > >\n> > > > > > > > +\n> > > > > > > > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > > > > > > > +the immediate termination of the application. The code below pauses the main\n> > > > > > > > +thread for 3 seconds, so that the event loop thread can process the requests.\n> > > > > > > >\n> > > > > > > >  .. code:: cpp\n> > > > > > > >\n> > > > > > > > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > > > > > > > -   Timer timer;\n> > > > > > > > -   timer.start(3000);\n> > > > > > > > -   while (timer.isRunning())\n> > > > > > > > -       dispatcher->processEvents();\n> > > > > > > > +   std::this_thread::sleep_for(3000ms);\n> > > > > > > >\n> > > > > > > >  Clean up and stop the application\n> > > > > > > >  ---------------------------------\n> >\n> > --\n> > Regards,\n> >\n> > Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A4C2CBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 13:53:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0231965637;\n\tFri, 17 Jun 2022 15:53:55 +0200 (CEST)","from mail-lf1-x131.google.com (mail-lf1-x131.google.com\n\t[IPv6:2a00:1450:4864:20::131])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C6C165633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 15:53:54 +0200 (CEST)","by mail-lf1-x131.google.com with SMTP id a29so7083973lfk.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 06:53:54 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655474035;\n\tbh=PQH7X8YHX0ARMptfWU0VzSSaaKD+6srePNFNr55HRq0=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=LezZ0yG+SiPdUPNkor7uSeFNFHNngEM9QNFZakGa8DYiqP/CkCrp38B8F4CKExHMG\n\t9eNlIw1koIcZYWm0VLHqrzoxeB1e1MidO6HTFlkWFQ7oAJZm2QZlkNdMvQpnVaxRM4\n\tmTIhdru/Lj/qAG14mAR1VxDrRYvZx+n6clLJyuoSV3Gg8EbaUp/PBPxvF8mqPOxw7X\n\tiPryI8s3vP9Qc6U+DrUwJYasF0LD4kgKvbSUvvsj6Eh/DLQ82VBl6BYvQ8WVBg3CGk\n\tnQxg64hgk18B63pV65k1srcPOWjySvF8AuqUeBEI/FnMTjAkUrq3fjgGB2dH9xM5QS\n\tPYKx3lTNUjzkQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=thaumatec-com.20210112.gappssmtp.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=fV1snQY2yDbHhO8TbV0DgQV1+KmhMYQP7wBAZeRF5Nw=;\n\tb=ptYfezm3sMzzoz1kauR/1tp4/mv9terNNyUFAV4XJXK4LByxY7ccKve8d7F7nheY9i\n\tBNnem21UsnOeNCR0LGFPPqLzV78dLM09jdzzWDlhmLofvs1+ROuFVU5s2DtUoCDqc1RC\n\tWlJquk1fv+LmhSLwTyYKXqdoWwXfpW95bUjwSpVvbPbUUBdVqFKT6oTqsyy0npJjzp8h\n\tn8WkCvw8aIcpPMVeKt6y9+PKvG6ApRgav8lLVqJmJKpPQ9NEUeaBtyjHvdcLfKAIZJAd\n\t0hOpq6EfXNzk9nCosHw7wctAZGf2WeHqHuAXj3KAmj5+GMzLfKaYFgEpSqJXZrOGqe//\n\tG0ag=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=thaumatec-com.20210112.gappssmtp.com\n\theader.i=@thaumatec-com.20210112.gappssmtp.com header.b=\"ptYfezm3\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=fV1snQY2yDbHhO8TbV0DgQV1+KmhMYQP7wBAZeRF5Nw=;\n\tb=Ytb23ItkiS18T9vC0BFRMVqDPE/Ig1UqMkJhG3y/hMqaoy/ide5JJ5uAYRV3absjPT\n\tvXwrt0s+bS0zwbXWzr5qWc4FzQvItBWWgaGMusy4HoIP9pyH7UQZh9b7qfbvb+76EKh4\n\tFaiaHHOiTzdbpgAgm//xW9siWZ/0A6nbicgGky8yr1IQW1oFMWgqAESUUuVXqEhYIXWA\n\tP2PTn8CMAwrbvA/OAfbo4oSFMn1KX/3w9ZXbpemsotbDotqH+pwtkfYkag863SP5TUd9\n\tuUrFntPhGRzeY5n71XxMsuv+khTMapmbAMrlEUdyZdlEQkC2+q54tjkacC7tTPqKq/Ep\n\tj6TA==","X-Gm-Message-State":"AJIora+N3iZiDk3+maSG8mFKnm06g/T4HG+S5zZHmxGrfVocAzEtENwn\n\tvUaG/jAH5ZXacLBCA8gBUxWVWYO9a2O0zOwOEll/QW00RtZgCQ==","X-Google-Smtp-Source":"AGRyM1t9dZr+zNpq4dU4kEsRiCYcTM9UzLaFerX4R6O2eB8mxbcWhzbu5qevOh2sl26ZqigtHbOFqQMxu0mBe/Q9KQk=","X-Received":"by 2002:a19:c213:0:b0:478:f00b:3d46 with SMTP id\n\tl19-20020a19c213000000b00478f00b3d46mr5862928lfc.394.1655474033302;\n\tFri, 17 Jun 2022 06:53:53 -0700 (PDT)","MIME-Version":"1.0","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>\n\t<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>\n\t<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>\n\t<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>\n\t<20220617093945.rwlbsvhotwshm6bz@uno.localdomain>\n\t<YqxoD76NzQVRKj2l@pendragon.ideasonboard.com>\n\t<20220617122258.owpmq3wx4ueukfrj@uno.localdomain>","In-Reply-To":"<20220617122258.owpmq3wx4ueukfrj@uno.localdomain>","Date":"Fri, 17 Jun 2022 15:53:41 +0200","Message-ID":"<CAHgnY3=Ro2=iLneDEcn6S_Afbz8p09cBDB7NBEq6n=SsdA=29w@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Daniel Semkowicz via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Daniel Semkowicz <dse@thaumatec.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23452,"web_url":"https://patchwork.libcamera.org/comment/23452/","msgid":"<YqyJrmdzuHP9HHW+@pendragon.ideasonboard.com>","date":"2022-06-17T14:03:26","subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Daniel,\n\nOn Fri, Jun 17, 2022 at 03:53:41PM +0200, Daniel Semkowicz wrote:\n> On Fri, Jun 17, 2022 at 2:23 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > On Fri, Jun 17, 2022 at 02:39:59PM +0300, Laurent Pinchart wrote:\n> > > On Fri, Jun 17, 2022 at 11:39:45AM +0200, Jacopo Mondi via libcamera-devel wrote:\n> > > > On Fri, Jun 17, 2022 at 11:28:19AM +0200, Daniel Semkowicz wrote:\n> > > > > The description sounds clear. I would just add minor changes.\n> > > > >\n> > > > > On Fri, Jun 17, 2022 at 10:01 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > > > > On Fri, Jun 17, 2022 at 09:24:50AM +0200, Daniel Semkowicz wrote:\n> > > > > > > On Thu, Jun 16, 2022 at 1:06 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> > > > > > > >\n> > > > > > > > Hi Daniel,\n> > > > > > > >\n> > > > > > > >    I wonder if we shouldn't just drop the whole\n> > > > > > > >\n> > > > > > > > Start an event loop\n> > > > > > > > ~~~~~~~~~~~~~~~~~~~\n> > > > > > > >\n> > > > > > > > paragraph\n> > > > > > >\n> > > > > > > I was also thinking about that when I was editing the current text.\n> > > > > > > It is always the decision on how many details about the internal\n> > > > > > > architecture We want to present to the developer in this guide.\n> > > > > > > As it is the introduction guide then maybe indeed it will be better to\n> > > > > > > keep it simple and do not talk too much about the internals.\n> > > > > > >\n> > > > > > > There will still be this one \"sleep_for(3000ms)\" line needed and I think\n> > > > > > > it would be good to leave some short explanation why it is here. Do you\n> > > > > > > think that adding it at the end of \"Request queueing\" section is a good\n> > > > > > > idea or should I create a separate section about it?\n> > > > > >\n> > > > > > You're right, throwing a sleep_for() without saying anything might be\n> > > > > > not the best idea :)\n> > > > > >\n> > > > > > Let's resume your original proposal and let me try to integrate it\n> > > > > > with a full rewrite of the paragraph.\n> > > > > >\n> > > > > > > > > -Start an event loop\n> > > > > > > > > +Event loop\n> > > > > > > > >  ~~~~~~~~~~~~~~~~~~~\n> > > > > > > > >\n> > > > > > > > >  The libcamera library needs an event loop to monitor and dispatch events\n> > > > > > > > > @@ -524,17 +526,17 @@ a notifier it is monitoring, it emits the notifier's\n> > > > > > > > >  notifiers' signals and emit application visible events, such as the\n> > > > > > > > >  ``Camera::bufferReady`` and ``Camera::requestCompleted`` signals.\n> > > > > > > > >\n> > > > > > > > > -The code below retrieves a reference to the system-wide event dispatcher and for\n> > > > > > > > > -the a fixed duration of 3 seconds, processes all the events detected in the\n> > > > > > > > > -system.\n> > > > > > > > > +Event loop is handled internally by ``CameraManager`` instance in a separate\n> > > > > > > > > +thread. ``CameraManager::start()`` creates a new thread and starts the event\n> > > > > > > > > +loop processing.\n> > > > > >\n> > > > > > Event loop\n> > > > > > ~~~~~~~~~~~~~~~~~~~\n> > >\n> > > Nitpicking, the underline should be shortened.\n> > >\n> > > > > >\n> > > > > > The libcamera library needs an event loop to monitor and dispatch\n> > > > > > events generated by the video devices part of the capture pipeline.\n> > > > > > libcamera runs its own event loop in a separate thread, created at\n> > > > > > ``CameraManager::start()_`` time. This means applications will run in\n> > > > > > their own thread and need to manage their own execution opportunely,\n> > > > > > to respond to user generate events and to libcamera generated events\n> > > > > > emitted through signals.\n> > > > >\n> > > > > typo: \"user generate\" -> \"user generated\"\n> > >\n> > > Or even \"user-generated\" I think.\n> > >\n> > > I'd write this a bit differently to avoid mentioning the internal event\n> > > loop as such. How about the following ?\n> > >\n> > > libcamera creates an internal execution thread at '`CameraManager::start()_``\n> > > time to decouple its own event processing from the application's main thread.\n> > > Applications are thus free to manage their own execution opportunely, and only\n> > > need to respond to events generated by libcamera emitted through signals.\n> > >\n> > > Real-world applications will likely either integrate with the event loop of the\n> > > framework they use, or create their own event loop to respond to user events.\n> > > For the simple application presented in this example, it is enough to prevent\n> > > immediate termination by pausing for 3 seconds. During that time, the libcamera\n> > > thread will generate request completion events that the application will handle\n> > > in the ``requestComplete()`` slot connected to the ``Camera::requestCompleted``\n> > > signal.\n> > >\n> \n> Then do We want to leave section name as \"Event loop\" or also change\n> it to something more general?\n\nGood point. It was initially about the libcamera event loop. We could\nkeep the name as-is, just shifting the meaning to refer to the\napplication event loop, but we could also rename it to \"Event handling\"\nor something similar. Up to you.\n\n> > Good, works for me!\n> >\n> > > > > > Real-world applications will likely either integrate in the event loop\n> > > > > > of higher level frameworks or create their own one to respond to user\n> > > > > > generated events, while for the simple application presented in this\n> > > > > > example it is enough to prevent immediate termination by pausing for 3\n> > > > > > seconds, during which the asynchronous request completion events\n> > > > > > generated by libcamera will be handled by the ``requestComplete()``\n> > > > > > slot connected to the ``Camera::requestCompleted`` signal.\n> > > > >\n> > > > > I would break down this part into less complex sentences to improve\n> > > > > readability. Something like:\n> > > > >\n> > > > > Real-world applications will likely either integrate in the event loop\n> > > > > of higher level frameworks or create their own one to respond to user\n> > > > > generated events. For the simple application presented in this example,\n> > > > > it is enough to prevent immediate termination by pausing for 3 seconds.\n> > > > > During this time, the asynchronous request completion events generated\n> > > > > by libcamera will be handled by the ``requestComplete()`` slot connected\n> > > > > to the ``Camera::requestCompleted`` signal.\n> > > > >\n> > > > > Is it ok?\n> > > >\n> > > > Thanks, much better!\n> > > >\n> > > > > > .. code:: cpp\n> > > > > >\n> > > > > >    std::this_thread::sleep_for(3000ms);\n> > > > > >\n> > > > > > What do you think ?\n> > > > > >\n> > > > > > > > > +\n> > > > > > > > > +As the ``CameraManager`` was already started in our example, we need to prevent\n> > > > > > > > > +the immediate termination of the application. The code below pauses the main\n> > > > > > > > > +thread for 3 seconds, so that the event loop thread can process the requests.\n> > > > > > > > >\n> > > > > > > > >  .. code:: cpp\n> > > > > > > > >\n> > > > > > > > > -   EventDispatcher *dispatcher = cm->eventDispatcher();\n> > > > > > > > > -   Timer timer;\n> > > > > > > > > -   timer.start(3000);\n> > > > > > > > > -   while (timer.isRunning())\n> > > > > > > > > -       dispatcher->processEvents();\n> > > > > > > > > +   std::this_thread::sleep_for(3000ms);\n> > > > > > > > >\n> > > > > > > > >  Clean up and stop the application\n> > > > > > > > >  ---------------------------------","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 68960BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jun 2022 14:03:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD98A65635;\n\tFri, 17 Jun 2022 16:03:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 95FC765632\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jun 2022 16:03:38 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 11DF3741;\n\tFri, 17 Jun 2022 16:03:38 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655474619;\n\tbh=O+Hlcfsjzsf0DVJvFeWmvkBxWF4M2EJxkFwktvh+FRM=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=RDHeFsawgblCiivSHcoJLUWEuzf45urr3hSnZHWObEjWunY01KKKZhfUIa6xbq1AJ\n\tirx3Cq3oir+d7vEes+KWk/F5n/qvNoPdE0gw5mWejfZCGtqpCqEc/ijcmU0bZkiqZx\n\tnymjM0EcRcvuI8Jhz5zpUrz/8OSACRUEKSeW3dhTOwDInwr+n+DROpdosiFJicd5dq\n\t00sMxegRx1Fd1wQt07NjTos+yiKtYPq/1AQEKMcBuPlqNHlyWuZGelh9ySmHwDEVTJ\n\ta8rm1kdm8R48YAhTYPtY3QhBvn4NQhqFUsVh8R7/MrrnCj+jpdHDQPtWTSr8EOVqUX\n\txlSYwqcARwb4A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655474618;\n\tbh=O+Hlcfsjzsf0DVJvFeWmvkBxWF4M2EJxkFwktvh+FRM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Q4PKy8ja2p//prXEJ6cgdF55CACY91Oq+6baMyJX5ZdOAhZQYhXx9RGaAXO091Gbj\n\tARFpspm7q382OI72vKJhGVGxj/Wfz5q8UKQc0RMDHJ8Xx+KEOCHeY+rGDFq9hY1CaO\n\tBLcM/e5uaEMJ6MiSfbj++0NJA0sRkCxQK+70vRKs="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Q4PKy8ja\"; dkim-atps=neutral","Date":"Fri, 17 Jun 2022 17:03:26 +0300","To":"Daniel Semkowicz <dse@thaumatec.com>","Message-ID":"<YqyJrmdzuHP9HHW+@pendragon.ideasonboard.com>","References":"<20220615162601.48619-1-dse@thaumatec.com>\n\t<20220615162601.48619-4-dse@thaumatec.com>\n\t<20220616110639.raznhr2mlu5czsgq@uno.localdomain>\n\t<CAHgnY3mLRUatOBofJfKGoseUw_zDisrVO-7gcsuXhOUdJqZKaQ@mail.gmail.com>\n\t<20220617080111.pmwffkatkoc6mmk7@uno.localdomain>\n\t<CAHgnY3n+rLODK8p8A0_-q4F=S=ztf_7fh=KnqrSVct7XuMbchg@mail.gmail.com>\n\t<20220617093945.rwlbsvhotwshm6bz@uno.localdomain>\n\t<YqxoD76NzQVRKj2l@pendragon.ideasonboard.com>\n\t<20220617122258.owpmq3wx4ueukfrj@uno.localdomain>\n\t<CAHgnY3=Ro2=iLneDEcn6S_Afbz8p09cBDB7NBEq6n=SsdA=29w@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAHgnY3=Ro2=iLneDEcn6S_Afbz8p09cBDB7NBEq6n=SsdA=29w@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] Documentation: Update the \"Start\n\tan event loop\" section","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]