[libcamera-devel,v2,5/9] libcamera: signal: Specify connection type for signals

Message ID 20191028104913.14985-6-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Add support for blocking method invocation
Related show

Commit Message

Laurent Pinchart Oct. 28, 2019, 10:49 a.m. UTC
Add a connection type parameter to the Signal::connect() method to
control signal delivery.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/signal.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Niklas Söderlund Oct. 29, 2019, 2:42 p.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2019-10-28 12:49:09 +0200, Laurent Pinchart wrote:
> Add a connection type parameter to the Signal::connect() method to
> control signal delivery.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  include/libcamera/signal.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/libcamera/signal.h b/include/libcamera/signal.h
> index b8a60281cceb..57598335932c 100644
> --- a/include/libcamera/signal.h
> +++ b/include/libcamera/signal.h
> @@ -55,11 +55,12 @@ public:
>  
>  #ifndef __DOXYGEN__
>  	template<typename T, typename std::enable_if<std::is_base_of<Object, T>::value>::type * = nullptr>
> -	void connect(T *obj, void (T::*func)(Args...))
> +	void connect(T *obj, void (T::*func)(Args...),
> +		     ConnectionType type = ConnectionTypeAuto)
>  	{
>  		Object *object = static_cast<Object *>(obj);
>  		object->connect(this);
> -		slots_.push_back(new BoundMemberMethod<T, Args...>(obj, object, func));
> +		slots_.push_back(new BoundMemberMethod<T, Args...>(obj, object, func, type));
>  	}
>  
>  	template<typename T, typename std::enable_if<!std::is_base_of<Object, T>::value>::type * = nullptr>
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/include/libcamera/signal.h b/include/libcamera/signal.h
index b8a60281cceb..57598335932c 100644
--- a/include/libcamera/signal.h
+++ b/include/libcamera/signal.h
@@ -55,11 +55,12 @@  public:
 
 #ifndef __DOXYGEN__
 	template<typename T, typename std::enable_if<std::is_base_of<Object, T>::value>::type * = nullptr>
-	void connect(T *obj, void (T::*func)(Args...))
+	void connect(T *obj, void (T::*func)(Args...),
+		     ConnectionType type = ConnectionTypeAuto)
 	{
 		Object *object = static_cast<Object *>(obj);
 		object->connect(this);
-		slots_.push_back(new BoundMemberMethod<T, Args...>(obj, object, func));
+		slots_.push_back(new BoundMemberMethod<T, Args...>(obj, object, func, type));
 	}
 
 	template<typename T, typename std::enable_if<!std::is_base_of<Object, T>::value>::type * = nullptr>