[RFC PATCH v1 5/5] node_device_udev: Rename `th` to `udevThread`

Marc Hartmayer posted 5 patches 1 year, 10 months ago
[RFC PATCH v1 5/5] node_device_udev: Rename `th` to `udevThread`
Posted by Marc Hartmayer 1 year, 10 months ago
The new thread name makes it easier to understand the purpose of the thread.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 src/node_device/node_device_udev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index ca60f6f7db82..87be5ae254ac 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -64,7 +64,7 @@ struct _udevEventData {
     int watch;
 
     /* Thread data */
-    virThread *th;
+    virThread *udevThread;
     virCond threadCond;
     bool threadQuit;
     bool dataReady;
@@ -1740,9 +1740,9 @@ nodeStateCleanup(void)
             virThreadJoin(priv->initThread);
             g_clear_pointer(&priv->initThread, g_free);
         }
-        if (priv->th) {
-            virThreadJoin(priv->th);
-            g_clear_pointer(&priv->th, g_free);
+        if (priv->udevThread) {
+            virThreadJoin(priv->udevThread);
+            g_clear_pointer(&priv->udevThread, g_free);
         }
     }
 
@@ -2335,12 +2335,12 @@ nodeStateInitialize(bool privileged,
         udev_monitor_set_receive_buffer_size(priv->udev_monitor,
                                              128 * 1024 * 1024);
 
-    priv->th = g_new0(virThread, 1);
-    if (virThreadCreateFull(priv->th, true, udevEventHandleThread,
+    priv->udevThread = g_new0(virThread, 1);
+    if (virThreadCreateFull(priv->udevThread, true, udevEventHandleThread,
                             "udev-event", false, NULL) < 0) {
         virReportSystemError(errno, "%s",
                              _("failed to create udev handler thread"));
-        g_clear_pointer(&priv->th, g_free);
+        g_clear_pointer(&priv->udevThread, g_free);
         goto unlock;
     }
 
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [RFC PATCH v1 5/5] node_device_udev: Rename `th` to `udevThread`
Posted by Boris Fiuczynski 1 year, 10 months ago
Makes sens and also adding the prefix to the other three attributes you 
mentioned in you follow up email.
To all four...
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>

On 4/3/24 16:03, Marc Hartmayer wrote:
> The new thread name makes it easier to understand the purpose of the thread.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>   src/node_device/node_device_udev.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index ca60f6f7db82..87be5ae254ac 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -64,7 +64,7 @@ struct _udevEventData {
>       int watch;
>   
>       /* Thread data */
> -    virThread *th;
> +    virThread *udevThread;
>       virCond threadCond;
>       bool threadQuit;
>       bool dataReady;
> @@ -1740,9 +1740,9 @@ nodeStateCleanup(void)
>               virThreadJoin(priv->initThread);
>               g_clear_pointer(&priv->initThread, g_free);
>           }
> -        if (priv->th) {
> -            virThreadJoin(priv->th);
> -            g_clear_pointer(&priv->th, g_free);
> +        if (priv->udevThread) {
> +            virThreadJoin(priv->udevThread);
> +            g_clear_pointer(&priv->udevThread, g_free);
>           }
>       }
>   
> @@ -2335,12 +2335,12 @@ nodeStateInitialize(bool privileged,
>           udev_monitor_set_receive_buffer_size(priv->udev_monitor,
>                                                128 * 1024 * 1024);
>   
> -    priv->th = g_new0(virThread, 1);
> -    if (virThreadCreateFull(priv->th, true, udevEventHandleThread,
> +    priv->udevThread = g_new0(virThread, 1);
> +    if (virThreadCreateFull(priv->udevThread, true, udevEventHandleThread,
>                               "udev-event", false, NULL) < 0) {
>           virReportSystemError(errno, "%s",
>                                _("failed to create udev handler thread"));
> -        g_clear_pointer(&priv->th, g_free);
> +        g_clear_pointer(&priv->udevThread, g_free);
>           goto unlock;
>       }
>   

-- 
Mit freundlichen Grüßen/Kind regards
    Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [RFC PATCH v1 5/5] node_device_udev: Rename `th` to `udevThread`
Posted by Marc Hartmayer 1 year, 10 months ago
On Wed, Apr 03, 2024 at 04:03 PM +0200, Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> The new thread name makes it easier to understand the purpose of the thread.
>
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  src/node_device/node_device_udev.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index ca60f6f7db82..87be5ae254ac 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -64,7 +64,7 @@ struct _udevEventData {
>      int watch;
>  
>      /* Thread data */
> -    virThread *th;
> +    virThread *udevThread;
>      virCond threadCond;
>      bool threadQuit;
>      bool dataReady;

It probably makes sense to add the prefix `udev` to threadCond,
threadQuite and dataReady as well.

[…snip…]

> 2.34.1
> _______________________________________________
> Devel mailing list -- devel@lists.libvirt.org
> To unsubscribe send an email to devel-leave@lists.libvirt.org
-- 
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org