tensor-filter-common: unnecessary usage of volatile
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 27 Oct 2021 14:04:49 +0000 (23:04 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 28 Oct 2021 08:09:44 +0000 (17:09 +0900)
GLib-Once (g_once_init_enter/leave) have already taken
care of concurrency.
Its users do not need to worry about cache coherency or
concurrency issues for the initialization.

Actually, as #3440 is showing, the volatile keyword
is neglected by g_once_init_enter function, making
the usage of volatile meaningless anyway.

Remove volatile keyword and mitigate the first
compiler warning-error of #3440

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
gst/nnstreamer/tensor_filter/tensor_filter_common.c

index 74f5bbe..9f08c44 100644 (file)
@@ -2762,9 +2762,9 @@ parse_accl_hw_fill (parse_accl_args accl_args)
 static GType
 accl_hw_get_type (void)
 {
-  static volatile gsize g_accl_hw_type_id__volatile = 0;
+  static gsize g_accl_hw_type_id_store = 0;
 
-  if (g_once_init_enter (&g_accl_hw_type_id__volatile)) {
+  if (g_once_init_enter (&g_accl_hw_type_id_store)) {
     static const GEnumValue values[] = {
       {ACCL_NONE, ACCL_NONE_STR, ACCL_NONE_STR},
       {ACCL_DEFAULT, ACCL_DEFAULT_STR, ACCL_DEFAULT_STR},
@@ -2788,10 +2788,10 @@ accl_hw_get_type (void)
 
     GType g_accl_hw_type_id =
         g_enum_register_static (g_intern_static_string ("accl_hw"), values);
-    g_once_init_leave (&g_accl_hw_type_id__volatile, g_accl_hw_type_id);
+    g_once_init_leave (&g_accl_hw_type_id_store, g_accl_hw_type_id);
   }
 
-  return g_accl_hw_type_id__volatile;
+  return g_accl_hw_type_id_store;
 }
 
 /**