[v3,1/2] libcamera: base: thread: Make `removeMessages()` public
diff mbox series

Message ID 20250926110708.94112-2-barnabas.pocze@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: pipeline: virtual: Move image generation to separate thread
Related show

Commit Message

Barnabás Pőcze Sept. 26, 2025, 11:07 a.m. UTC
Sometimes there is a need to remove pending messages of an object. For example,
when the main purpose of a thread is to carry out work asynchronously using
invoke messages, then there might be a need to stop processing because some
kind of state has changed. This can be done in two main ways: flushing messages
or removing them. This changes enables the second option, which is useful if
the effects of the pending messages are no longer desired.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/base/thread.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Sept. 28, 2025, 11 a.m. UTC | #1
Quoting Barnabás Pőcze (2025-09-26 12:07:07)
> Sometimes there is a need to remove pending messages of an object. For example,
> when the main purpose of a thread is to carry out work asynchronously using
> invoke messages, then there might be a need to stop processing because some
> kind of state has changed. This can be done in two main ways: flushing messages
> or removing them. This changes enables the second option, which is useful if
> the effects of the pending messages are no longer desired.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  include/libcamera/base/thread.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
> index b9284c2c0..eb1a52ab1 100644
> --- a/include/libcamera/base/thread.h
> +++ b/include/libcamera/base/thread.h
> @@ -50,6 +50,7 @@ public:
>  
>         void dispatchMessages(Message::Type type = Message::Type::None,
>                               Object *receiver = nullptr);
> +       void removeMessages(Object *receiver);
>  
>  protected:
>         int exec();
> @@ -64,7 +65,6 @@ private:
>         void setThreadAffinityInternal();
>  
>         void postMessage(std::unique_ptr<Message> msg, Object *receiver);
> -       void removeMessages(Object *receiver);
>  
>         friend class Object;
>         friend class ThreadData;
> -- 
> 2.51.0
>

Patch
diff mbox series

diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
index b9284c2c0..eb1a52ab1 100644
--- a/include/libcamera/base/thread.h
+++ b/include/libcamera/base/thread.h
@@ -50,6 +50,7 @@  public:
 
 	void dispatchMessages(Message::Type type = Message::Type::None,
 			      Object *receiver = nullptr);
+	void removeMessages(Object *receiver);
 
 protected:
 	int exec();
@@ -64,7 +65,6 @@  private:
 	void setThreadAffinityInternal();
 
 	void postMessage(std::unique_ptr<Message> msg, Object *receiver);
-	void removeMessages(Object *receiver);
 
 	friend class Object;
 	friend class ThreadData;