[{"id":2475,"web_url":"https://patchwork.libcamera.org/comment/2475/","msgid":"<20190819090320.s4rqnokdjwyomhoy@uno.localdomain>","date":"2019-08-19T09:03:20","subject":"Re: [libcamera-devel] [PATCH 07/14] test: Get event dispatcher from\n\tcurrent thread","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n  regardless of the discussion on the instance() operation, I think\nthis is good, but please see a few comments below.\n\nMinors apart:\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\nOn Sun, Aug 18, 2019 at 04:13:22AM +0300, Laurent Pinchart wrote:\n> For all tests that don't otherwise require access to the camera manager,\n> get the event dispatcher from the current thread instead of the camera\n> manager. This prepares for the removal of CameraManager::instance().\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  test/event-dispatcher.cpp                | 4 ++--\n>  test/event.cpp                           | 4 ++--\n>  test/ipc/unixsocket.cpp                  | 6 +++---\n>  test/log/log_process.cpp                 | 4 ++--\n>  test/meson.build                         | 6 +++---\n>  test/object-invoke.cpp                   | 3 +--\n>  test/process/process_test.cpp            | 4 ++--\n>  test/timer.cpp                           | 4 ++--\n>  test/v4l2_videodevice/buffer_sharing.cpp | 4 ++--\n>  test/v4l2_videodevice/capture_async.cpp  | 4 ++--\n>  test/v4l2_videodevice/v4l2_m2mdevice.cpp | 4 ++--\n>  11 files changed, 23 insertions(+), 24 deletions(-)\n>\n> diff --git a/test/event-dispatcher.cpp b/test/event-dispatcher.cpp\n> index e8818dcab4ad..f243ec39bc28 100644\n> --- a/test/event-dispatcher.cpp\n> +++ b/test/event-dispatcher.cpp\n> @@ -9,11 +9,11 @@\n>  #include <signal.h>\n>  #include <sys/time.h>\n>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/timer.h>\n>\n>  #include \"test.h\"\n> +#include \"thread.h\"\n>\n>  using namespace std;\n>  using namespace libcamera;\n> @@ -33,7 +33,7 @@ protected:\n>\n>  \tint init()\n>  \t{\n> -\t\tdispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tdispatcher = Thread::current()->eventDispatcher();\n>\n>  \t\tstruct sigaction sa = {};\n>  \t\tsa.sa_handler = &sigAlarmHandler;\n> diff --git a/test/event.cpp b/test/event.cpp\n> index 9bd876153a18..816060cc44a2 100644\n> --- a/test/event.cpp\n> +++ b/test/event.cpp\n> @@ -9,12 +9,12 @@\n>  #include <string.h>\n>  #include <unistd.h>\n>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/event_notifier.h>\n>  #include <libcamera/timer.h>\n>\n>  #include \"test.h\"\n> +#include \"thread.h\"\n>\n>  using namespace std;\n>  using namespace libcamera;\n> @@ -35,7 +35,7 @@ protected:\n>\n>  \tint run()\n>  \t{\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tstd::string data(\"H2G2\");\n>  \t\tTimer timeout;\n>  \t\tssize_t ret;\n> diff --git a/test/ipc/unixsocket.cpp b/test/ipc/unixsocket.cpp\n> index 40a3a84a87d2..f53042b88720 100644\n> --- a/test/ipc/unixsocket.cpp\n> +++ b/test/ipc/unixsocket.cpp\n> @@ -15,12 +15,12 @@\n>  #include <sys/wait.h>\n>  #include <unistd.h>\n>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/timer.h>\n>\n>  #include \"ipc_unixsocket.h\"\n>  #include \"test.h\"\n> +#include \"thread.h\"\n>  #include \"utils.h\"\n>\n>  #define CMD_CLOSE\t0\n> @@ -47,7 +47,7 @@ public:\n>  \tUnixSocketTestSlave()\n>  \t\t: exitCode_(EXIT_FAILURE), exit_(false)\n>  \t{\n> -\t\tdispatcher_ = CameraManager::instance()->eventDispatcher();\n> +\t\tdispatcher_ = Thread::current()->eventDispatcher();\n>  \t\tipc_.readyRead.connect(this, &UnixSocketTestSlave::readyRead);\n>  \t}\n>\n> @@ -436,7 +436,7 @@ private:\n>  \t\t\t\treturn -ETIMEDOUT;\n>  \t\t\t}\n>\n> -\t\t\tCameraManager::instance()->eventDispatcher()->processEvents();\n> +\t\t\tThread::current()->eventDispatcher()->processEvents();\n>  \t\t}\n>\n>  \t\tcallResponse_ = nullptr;\n> diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp\n> index 36d25b27bfea..2df4aa43713c 100644\n> --- a/test/log/log_process.cpp\n> +++ b/test/log/log_process.cpp\n> @@ -14,7 +14,6 @@\n>  #include <unistd.h>\n>  #include <vector>\n>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/logging.h>\n>  #include <libcamera/timer.h>\n> @@ -22,6 +21,7 @@\n>  #include \"log.h\"\n>  #include \"process.h\"\n>  #include \"test.h\"\n> +#include \"thread.h\"\n>  #include \"utils.h\"\n>\n>  using namespace std;\n> @@ -65,7 +65,7 @@ protected:\n>\n>  \tint run()\n>  \t{\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tTimer timeout;\n>\n>  \t\tint exitCode = 42;\n> diff --git a/test/meson.build b/test/meson.build\n> index 05265b7d4976..84722cceb35d 100644\n> --- a/test/meson.build\n> +++ b/test/meson.build\n> @@ -13,22 +13,22 @@ subdir('v4l2_subdevice')\n>  subdir('v4l2_videodevice')\n>\n>  public_tests = [\n> -    ['event',                           'event.cpp'],\n> -    ['event-dispatcher',                'event-dispatcher.cpp'],\n>      ['geometry',                        'geometry.cpp'],\n>      ['list-cameras',                    'list-cameras.cpp'],\n>      ['signal',                          'signal.cpp'],\n> -    ['timer',                           'timer.cpp'],\n>  ]\n>\n>  internal_tests = [\n>      ['camera-sensor',                   'camera-sensor.cpp'],\n> +    ['event',                           'event.cpp'],\n> +    ['event-dispatcher',                'event-dispatcher.cpp'],\n>      ['event-thread',                    'event-thread.cpp'],\n>      ['message',                         'message.cpp'],\n>      ['object',                          'object.cpp'],\n>      ['object-invoke',                   'object-invoke.cpp'],\n>      ['signal-threads',                  'signal-threads.cpp'],\n>      ['threads',                         'threads.cpp'],\n> +    ['timer',                           'timer.cpp'],\n>      ['timer-thread',                    'timer-thread.cpp'],\n>  ]\n>\nThis seems unrelated...\n\n> diff --git a/test/object-invoke.cpp b/test/object-invoke.cpp\n> index 7221930f4380..9fb93e140305 100644\n> --- a/test/object-invoke.cpp\n> +++ b/test/object-invoke.cpp\n> @@ -9,7 +9,6 @@\n>  #include <iostream>\n>  #include <thread>\n>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/object.h>\n\nWhile at it, could you re-sort the following:\n\n#include \"thread.h\"\n#include \"test.h\"\n\n>\n> @@ -61,7 +60,7 @@ class ObjectInvokeTest : public Test\n>  protected:\n>  \tint run()\n>  \t{\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tInvokedObject object;\n>\n>  \t\t/*\n> diff --git a/test/process/process_test.cpp b/test/process/process_test.cpp\n> index acb161454e2e..d264555e545f 100644\n> --- a/test/process/process_test.cpp\n> +++ b/test/process/process_test.cpp\n> @@ -9,12 +9,12 @@\n>  #include <unistd.h>\n>  #include <vector>\n>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/timer.h>\n>\n>  #include \"process.h\"\n>  #include \"test.h\"\n> +#include \"thread.h\"\n>  #include \"utils.h\"\n>\n>  using namespace std;\n> @@ -41,7 +41,7 @@ public:\n>  protected:\n>  \tint run()\n>  \t{\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tTimer timeout;\n>\n>  \t\tint exitCode = 42;\n> diff --git a/test/timer.cpp b/test/timer.cpp\n> index addebce3c784..c30709d4109a 100644\n> --- a/test/timer.cpp\n> +++ b/test/timer.cpp\n> @@ -7,11 +7,11 @@\n>\n>  #include <iostream>\n>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/timer.h>\n>\n>  #include \"test.h\"\n> +#include \"thread.h\"\n>\n>  using namespace std;\n>  using namespace libcamera;\n> @@ -62,7 +62,7 @@ protected:\n>\n>  \tint run()\n>  \t{\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tManagedTimer timer;\n>  \t\tManagedTimer timer2;\n>\n> diff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp\n> index 12ec88f2d8e6..1629f34cfa6c 100644\n> --- a/test/v4l2_videodevice/buffer_sharing.cpp\n> +++ b/test/v4l2_videodevice/buffer_sharing.cpp\n> @@ -13,10 +13,10 @@\n>  #include <iostream>\n>\n>  #include <libcamera/buffer.h>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/timer.h>\n>\n> +#include \"thread.h\"\n>  #include \"v4l2_videodevice_test.h\"\n>\n>  class BufferSharingTest : public V4L2VideoDeviceTest\n> @@ -116,7 +116,7 @@ protected:\n>\n>  \tint run()\n>  \t{\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tTimer timeout;\n>  \t\tint ret;\n>\n> diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp\n> index 4909f71a3f34..17eb528b12fd 100644\n> --- a/test/v4l2_videodevice/capture_async.cpp\n> +++ b/test/v4l2_videodevice/capture_async.cpp\n> @@ -6,12 +6,12 @@\n>   */\n>\n>  #include <libcamera/buffer.h>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/timer.h>\n>\n>  #include <iostream>\n>\n> +#include \"thread.h\"\n>  #include \"v4l2_videodevice_test.h\"\n>\n>  class CaptureAsyncTest : public V4L2VideoDeviceTest\n> @@ -34,7 +34,7 @@ protected:\n>  \t{\n>  \t\tconst unsigned int bufferCount = 8;\n>\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tTimer timeout;\n>  \t\tint ret;\n>\n> diff --git a/test/v4l2_videodevice/v4l2_m2mdevice.cpp b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> index d132b1db2432..4d3644c2d287 100644\n> --- a/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> +++ b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> @@ -8,12 +8,12 @@\n>  #include <iostream>\n>\n>  #include <libcamera/buffer.h>\n> -#include <libcamera/camera_manager.h>\n>  #include <libcamera/event_dispatcher.h>\n>  #include <libcamera/timer.h>\n>\n>  #include \"device_enumerator.h\"\n>  #include \"media_device.h\"\n> +#include \"thread.h\"\n>  #include \"v4l2_videodevice.h\"\n>\n>  #include \"test.h\"\n> @@ -80,7 +80,7 @@ protected:\n>  \t{\n>  \t\tconstexpr unsigned int bufferCount = 4;\n>\n> -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n>  \t\tint ret;\n>\n>  \t\tMediaEntity *entity = media_->getEntityByName(\"vim2m-source\");\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 180C360E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Aug 2019 11:01:53 +0200 (CEST)","from uno.localdomain (unknown [87.18.63.98])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id E2DA04000C;\n\tMon, 19 Aug 2019 09:01:51 +0000 (UTC)"],"X-Originating-IP":"87.18.63.98","Date":"Mon, 19 Aug 2019 11:03:20 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190819090320.s4rqnokdjwyomhoy@uno.localdomain>","References":"<20190818011329.14499-1-laurent.pinchart@ideasonboard.com>\n\t<20190818011329.14499-8-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"irpxdhwbenwwemes\"","Content-Disposition":"inline","In-Reply-To":"<20190818011329.14499-8-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 07/14] test: Get event dispatcher from\n\tcurrent thread","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Mon, 19 Aug 2019 09:01:53 -0000"}},{"id":2489,"web_url":"https://patchwork.libcamera.org/comment/2489/","msgid":"<20190819151027.GJ5011@pendragon.ideasonboard.com>","date":"2019-08-19T15:10:27","subject":"Re: [libcamera-devel] [PATCH 07/14] test: Get event dispatcher from\n\tcurrent thread","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Mon, Aug 19, 2019 at 11:03:20AM +0200, Jacopo Mondi wrote:\n> Hi Laurent,\n>   regardless of the discussion on the instance() operation, I think\n> this is good, but please see a few comments below.\n> \n> Minors apart:\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> On Sun, Aug 18, 2019 at 04:13:22AM +0300, Laurent Pinchart wrote:\n> > For all tests that don't otherwise require access to the camera manager,\n> > get the event dispatcher from the current thread instead of the camera\n> > manager. This prepares for the removal of CameraManager::instance().\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  test/event-dispatcher.cpp                | 4 ++--\n> >  test/event.cpp                           | 4 ++--\n> >  test/ipc/unixsocket.cpp                  | 6 +++---\n> >  test/log/log_process.cpp                 | 4 ++--\n> >  test/meson.build                         | 6 +++---\n> >  test/object-invoke.cpp                   | 3 +--\n> >  test/process/process_test.cpp            | 4 ++--\n> >  test/timer.cpp                           | 4 ++--\n> >  test/v4l2_videodevice/buffer_sharing.cpp | 4 ++--\n> >  test/v4l2_videodevice/capture_async.cpp  | 4 ++--\n> >  test/v4l2_videodevice/v4l2_m2mdevice.cpp | 4 ++--\n> >  11 files changed, 23 insertions(+), 24 deletions(-)\n> >\n> > diff --git a/test/event-dispatcher.cpp b/test/event-dispatcher.cpp\n> > index e8818dcab4ad..f243ec39bc28 100644\n> > --- a/test/event-dispatcher.cpp\n> > +++ b/test/event-dispatcher.cpp\n> > @@ -9,11 +9,11 @@\n> >  #include <signal.h>\n> >  #include <sys/time.h>\n> >\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/timer.h>\n> >\n> >  #include \"test.h\"\n> > +#include \"thread.h\"\n> >\n> >  using namespace std;\n> >  using namespace libcamera;\n> > @@ -33,7 +33,7 @@ protected:\n> >\n> >  \tint init()\n> >  \t{\n> > -\t\tdispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tdispatcher = Thread::current()->eventDispatcher();\n> >\n> >  \t\tstruct sigaction sa = {};\n> >  \t\tsa.sa_handler = &sigAlarmHandler;\n> > diff --git a/test/event.cpp b/test/event.cpp\n> > index 9bd876153a18..816060cc44a2 100644\n> > --- a/test/event.cpp\n> > +++ b/test/event.cpp\n> > @@ -9,12 +9,12 @@\n> >  #include <string.h>\n> >  #include <unistd.h>\n> >\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/event_notifier.h>\n> >  #include <libcamera/timer.h>\n> >\n> >  #include \"test.h\"\n> > +#include \"thread.h\"\n> >\n> >  using namespace std;\n> >  using namespace libcamera;\n> > @@ -35,7 +35,7 @@ protected:\n> >\n> >  \tint run()\n> >  \t{\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tstd::string data(\"H2G2\");\n> >  \t\tTimer timeout;\n> >  \t\tssize_t ret;\n> > diff --git a/test/ipc/unixsocket.cpp b/test/ipc/unixsocket.cpp\n> > index 40a3a84a87d2..f53042b88720 100644\n> > --- a/test/ipc/unixsocket.cpp\n> > +++ b/test/ipc/unixsocket.cpp\n> > @@ -15,12 +15,12 @@\n> >  #include <sys/wait.h>\n> >  #include <unistd.h>\n> >\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/timer.h>\n> >\n> >  #include \"ipc_unixsocket.h\"\n> >  #include \"test.h\"\n> > +#include \"thread.h\"\n> >  #include \"utils.h\"\n> >\n> >  #define CMD_CLOSE\t0\n> > @@ -47,7 +47,7 @@ public:\n> >  \tUnixSocketTestSlave()\n> >  \t\t: exitCode_(EXIT_FAILURE), exit_(false)\n> >  \t{\n> > -\t\tdispatcher_ = CameraManager::instance()->eventDispatcher();\n> > +\t\tdispatcher_ = Thread::current()->eventDispatcher();\n> >  \t\tipc_.readyRead.connect(this, &UnixSocketTestSlave::readyRead);\n> >  \t}\n> >\n> > @@ -436,7 +436,7 @@ private:\n> >  \t\t\t\treturn -ETIMEDOUT;\n> >  \t\t\t}\n> >\n> > -\t\t\tCameraManager::instance()->eventDispatcher()->processEvents();\n> > +\t\t\tThread::current()->eventDispatcher()->processEvents();\n> >  \t\t}\n> >\n> >  \t\tcallResponse_ = nullptr;\n> > diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp\n> > index 36d25b27bfea..2df4aa43713c 100644\n> > --- a/test/log/log_process.cpp\n> > +++ b/test/log/log_process.cpp\n> > @@ -14,7 +14,6 @@\n> >  #include <unistd.h>\n> >  #include <vector>\n> >\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/logging.h>\n> >  #include <libcamera/timer.h>\n> > @@ -22,6 +21,7 @@\n> >  #include \"log.h\"\n> >  #include \"process.h\"\n> >  #include \"test.h\"\n> > +#include \"thread.h\"\n> >  #include \"utils.h\"\n> >\n> >  using namespace std;\n> > @@ -65,7 +65,7 @@ protected:\n> >\n> >  \tint run()\n> >  \t{\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tTimer timeout;\n> >\n> >  \t\tint exitCode = 42;\n> > diff --git a/test/meson.build b/test/meson.build\n> > index 05265b7d4976..84722cceb35d 100644\n> > --- a/test/meson.build\n> > +++ b/test/meson.build\n> > @@ -13,22 +13,22 @@ subdir('v4l2_subdevice')\n> >  subdir('v4l2_videodevice')\n> >\n> >  public_tests = [\n> > -    ['event',                           'event.cpp'],\n> > -    ['event-dispatcher',                'event-dispatcher.cpp'],\n> >      ['geometry',                        'geometry.cpp'],\n> >      ['list-cameras',                    'list-cameras.cpp'],\n> >      ['signal',                          'signal.cpp'],\n> > -    ['timer',                           'timer.cpp'],\n> >  ]\n> >\n> >  internal_tests = [\n> >      ['camera-sensor',                   'camera-sensor.cpp'],\n> > +    ['event',                           'event.cpp'],\n> > +    ['event-dispatcher',                'event-dispatcher.cpp'],\n> >      ['event-thread',                    'event-thread.cpp'],\n> >      ['message',                         'message.cpp'],\n> >      ['object',                          'object.cpp'],\n> >      ['object-invoke',                   'object-invoke.cpp'],\n> >      ['signal-threads',                  'signal-threads.cpp'],\n> >      ['threads',                         'threads.cpp'],\n> > +    ['timer',                           'timer.cpp'],\n> >      ['timer-thread',                    'timer-thread.cpp'],\n> >  ]\n> >\n>\n> This seems unrelated...\n\nNo really, the tests now use the thread.h header to retrieve the event\ndispatcher from the thread, so they need access to internal headers.\n\n> > diff --git a/test/object-invoke.cpp b/test/object-invoke.cpp\n> > index 7221930f4380..9fb93e140305 100644\n> > --- a/test/object-invoke.cpp\n> > +++ b/test/object-invoke.cpp\n> > @@ -9,7 +9,6 @@\n> >  #include <iostream>\n> >  #include <thread>\n> >\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/object.h>\n> \n> While at it, could you re-sort the following:\n> \n> #include \"thread.h\"\n> #include \"test.h\"\n\nOK\n\n> > @@ -61,7 +60,7 @@ class ObjectInvokeTest : public Test\n> >  protected:\n> >  \tint run()\n> >  \t{\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tInvokedObject object;\n> >\n> >  \t\t/*\n> > diff --git a/test/process/process_test.cpp b/test/process/process_test.cpp\n> > index acb161454e2e..d264555e545f 100644\n> > --- a/test/process/process_test.cpp\n> > +++ b/test/process/process_test.cpp\n> > @@ -9,12 +9,12 @@\n> >  #include <unistd.h>\n> >  #include <vector>\n> >\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/timer.h>\n> >\n> >  #include \"process.h\"\n> >  #include \"test.h\"\n> > +#include \"thread.h\"\n> >  #include \"utils.h\"\n> >\n> >  using namespace std;\n> > @@ -41,7 +41,7 @@ public:\n> >  protected:\n> >  \tint run()\n> >  \t{\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tTimer timeout;\n> >\n> >  \t\tint exitCode = 42;\n> > diff --git a/test/timer.cpp b/test/timer.cpp\n> > index addebce3c784..c30709d4109a 100644\n> > --- a/test/timer.cpp\n> > +++ b/test/timer.cpp\n> > @@ -7,11 +7,11 @@\n> >\n> >  #include <iostream>\n> >\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/timer.h>\n> >\n> >  #include \"test.h\"\n> > +#include \"thread.h\"\n> >\n> >  using namespace std;\n> >  using namespace libcamera;\n> > @@ -62,7 +62,7 @@ protected:\n> >\n> >  \tint run()\n> >  \t{\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tManagedTimer timer;\n> >  \t\tManagedTimer timer2;\n> >\n> > diff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp\n> > index 12ec88f2d8e6..1629f34cfa6c 100644\n> > --- a/test/v4l2_videodevice/buffer_sharing.cpp\n> > +++ b/test/v4l2_videodevice/buffer_sharing.cpp\n> > @@ -13,10 +13,10 @@\n> >  #include <iostream>\n> >\n> >  #include <libcamera/buffer.h>\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/timer.h>\n> >\n> > +#include \"thread.h\"\n> >  #include \"v4l2_videodevice_test.h\"\n> >\n> >  class BufferSharingTest : public V4L2VideoDeviceTest\n> > @@ -116,7 +116,7 @@ protected:\n> >\n> >  \tint run()\n> >  \t{\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tTimer timeout;\n> >  \t\tint ret;\n> >\n> > diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp\n> > index 4909f71a3f34..17eb528b12fd 100644\n> > --- a/test/v4l2_videodevice/capture_async.cpp\n> > +++ b/test/v4l2_videodevice/capture_async.cpp\n> > @@ -6,12 +6,12 @@\n> >   */\n> >\n> >  #include <libcamera/buffer.h>\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/timer.h>\n> >\n> >  #include <iostream>\n> >\n> > +#include \"thread.h\"\n> >  #include \"v4l2_videodevice_test.h\"\n> >\n> >  class CaptureAsyncTest : public V4L2VideoDeviceTest\n> > @@ -34,7 +34,7 @@ protected:\n> >  \t{\n> >  \t\tconst unsigned int bufferCount = 8;\n> >\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tTimer timeout;\n> >  \t\tint ret;\n> >\n> > diff --git a/test/v4l2_videodevice/v4l2_m2mdevice.cpp b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> > index d132b1db2432..4d3644c2d287 100644\n> > --- a/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> > +++ b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> > @@ -8,12 +8,12 @@\n> >  #include <iostream>\n> >\n> >  #include <libcamera/buffer.h>\n> > -#include <libcamera/camera_manager.h>\n> >  #include <libcamera/event_dispatcher.h>\n> >  #include <libcamera/timer.h>\n> >\n> >  #include \"device_enumerator.h\"\n> >  #include \"media_device.h\"\n> > +#include \"thread.h\"\n> >  #include \"v4l2_videodevice.h\"\n> >\n> >  #include \"test.h\"\n> > @@ -80,7 +80,7 @@ protected:\n> >  \t{\n> >  \t\tconstexpr unsigned int bufferCount = 4;\n> >\n> > -\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n> > +\t\tEventDispatcher *dispatcher = Thread::current()->eventDispatcher();\n> >  \t\tint ret;\n> >\n> >  \t\tMediaEntity *entity = media_->getEntityByName(\"vim2m-source\");","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1241760C1E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Aug 2019 17:10:33 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C296510;\n\tMon, 19 Aug 2019 17:10:32 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1566227432;\n\tbh=M/CafXaL4ywS8jF7lLWklRGLSZoG63kXakjf7BTT3aM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hr1+sIUZYT9SUm+leab5Yo89Omd2NeMQKpvwphnOiNqkE6tIu0bBkahsGmuZMwmn9\n\tjFOM2LExTZvXDqRiYFFitX2Z/7hX/r8+Bvmhsv/mf08hgA6IZW3UmQtemSB5ztAU6E\n\tyVLii95IAC8y4X55Gdpof0G9kSX0TPOSLhuTNdcU=","Date":"Mon, 19 Aug 2019 18:10:27 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190819151027.GJ5011@pendragon.ideasonboard.com>","References":"<20190818011329.14499-1-laurent.pinchart@ideasonboard.com>\n\t<20190818011329.14499-8-laurent.pinchart@ideasonboard.com>\n\t<20190819090320.s4rqnokdjwyomhoy@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190819090320.s4rqnokdjwyomhoy@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 07/14] test: Get event dispatcher from\n\tcurrent thread","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Mon, 19 Aug 2019 15:10:33 -0000"}}]