[vlc-commits] [Git][videolan/vlc][master] 2 commits: threads: remove stray mutex_cleanup_push() uses

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Nov 5 09:20:03 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
87b1c602 by Rémi Denis-Courmont at 2021-11-05T08:42:00+00:00
threads: remove stray mutex_cleanup_push() uses

As of c0f0d08518e48782023fc03121ba10ea2df7084f, waiting on a condition
variable is no longer a cancellation point. So these cleanup handlers
no longer serve any purpose.

- - - - -
58db2309 by Rémi Denis-Courmont at 2021-11-05T08:42:00+00:00
threads: remove no longer used mutex_cleanup_push()

- - - - -


4 changed files:

- include/vlc_threads.h
- modules/access/http/h2conn.c
- src/misc/variables.c
- src/test/thread.c


Changes:

=====================================
include/vlc_threads.h
=====================================
@@ -993,12 +993,6 @@ struct vlc_cleanup_t
 
 #endif /* !LIBVLC_USE_PTHREAD_CLEANUP */
 
-static inline void vlc_cleanup_lock (void *lock)
-{
-    vlc_mutex_unlock ((vlc_mutex_t *)lock);
-}
-#define mutex_cleanup_push( lock ) vlc_cleanup_push (vlc_cleanup_lock, lock)
-
 #ifdef __cplusplus
 /**
  * Helper C++ class to lock a mutex.


=====================================
modules/access/http/h2conn.c
=====================================
@@ -267,11 +267,7 @@ static struct vlc_http_msg *vlc_h2_stream_wait(struct vlc_http_stream *stream)
 
     vlc_h2_stream_lock(s);
     while ((m = s->recv_hdr) == NULL && !s->recv_end && !s->interrupted)
-    {
-        mutex_cleanup_push(&conn->lock);
         vlc_cond_wait(&s->recv_wait, &conn->lock);
-        vlc_cleanup_pop();
-    }
     s->recv_hdr = NULL;
     vlc_h2_stream_unlock(s);
 
@@ -315,9 +311,7 @@ static ssize_t vlc_h2_stream_write(struct vlc_http_stream *stream,
                 break;
             }
 
-            mutex_cleanup_push(&conn->lock);
             vlc_cond_wait(&s->send_wait, &conn->lock);
-            vlc_cleanup_pop();
             continue;
         }
 
@@ -332,9 +326,7 @@ static ssize_t vlc_h2_stream_write(struct vlc_http_stream *stream,
                 break;
             }
 
-            mutex_cleanup_push(&conn->lock);
             vlc_cond_wait(&conn->send_wait, &conn->lock);
-            vlc_cleanup_pop();
             continue;
         }
 
@@ -390,11 +382,7 @@ static block_t *vlc_h2_stream_read(struct vlc_http_stream *stream)
 
     vlc_h2_stream_lock(s);
     while ((f = s->recv_head) == NULL && !s->recv_end && !s->interrupted)
-    {
-        mutex_cleanup_push(&conn->lock);
         vlc_cond_wait(&s->recv_wait, &conn->lock);
-        vlc_cleanup_pop();
-    }
 
     if (f == NULL)
     {


=====================================
src/misc/variables.c
=====================================
@@ -228,10 +228,8 @@ static void WaitUnused(vlc_object_t *obj, variable_t *var)
 {
     vlc_object_internals_t *priv = vlc_internals(obj);
 
-    mutex_cleanup_push(&priv->var_lock);
     while (var->b_incallback)
         vlc_cond_wait(&var->wait, &priv->var_lock);
-    vlc_cleanup_pop();
 }
 
 static void TriggerCallback(vlc_object_t *obj, variable_t *var,


=====================================
src/test/thread.c
=====================================
@@ -169,11 +169,8 @@ static void *thread_func_cond(void *ptr)
 
     // Wait until termination is allowed
     vlc_mutex_lock(&data->mutex);
-    mutex_cleanup_push(&data->mutex);
-    while(data->state != -1) {
+    while (data->state != -1)
         vlc_cond_wait(&data->cond_end, &data->mutex);
-    }
-    vlc_cleanup_pop();
     vlc_mutex_unlock(&data->mutex);
 
     return &thread_return_magic;
@@ -250,7 +247,6 @@ static void *thread_func_cond_timeout(void *ptr)
     vlc_mutex_unlock(&data->mutex);
 
     vlc_mutex_lock(&data->mutex);
-    mutex_cleanup_push(&data->mutex);
 
     // Wait until termination is allowed (which is never signalled)
     vlc_tick_t now = vlc_tick_now();
@@ -261,7 +257,6 @@ static void *thread_func_cond_timeout(void *ptr)
     vlc_tick_t elapsed = vlc_tick_now() - now;
     assert(elapsed >= VLC_TICK_FROM_MS(25));
 
-    vlc_cleanup_pop();
     vlc_mutex_unlock(&data->mutex);
 
     return &thread_return_magic;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e74021faf84f8d1265589dc12441cd780d72f01f...58db23092cfa31ea7977ca8f5a8a3b641911f9c4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e74021faf84f8d1265589dc12441cd780d72f01f...58db23092cfa31ea7977ca8f5a8a3b641911f9c4
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list