[vlc-devel] [PATCH 4/7] thread: remove vlc_sem_destroy()

RĂ©mi Denis-Courmont remi at remlab.net
Sun Feb 16 18:50:43 CET 2020


This has become a useless no-op on all platforms.
---
 include/vlc_cxx_helpers.hpp                  | 1 -
 include/vlc_threads.h                        | 5 -----
 modules/access/http/h2output_test.c          | 4 ----
 modules/audio_output/coreaudio_common.c      | 1 -
 modules/gui/skins2/src/skin_main.cpp         | 2 --
 modules/hw/mmal/converter.c                  | 2 --
 modules/keystore/secret.c                    | 1 -
 modules/stream_out/sdi/SDIStream.cpp         | 1 -
 modules/stream_out/transcode/encoder/video.c | 2 --
 modules/video_output/splitter.c              | 2 --
 modules/video_output/win32/window.c          | 1 -
 src/android/thread.c                         | 1 -
 src/input/vlm.c                              | 1 -
 src/libvlccore.sym                           | 1 -
 src/linux/getaddrinfo.c                      | 4 ----
 src/misc/threads.c                           | 5 -----
 src/posix/getaddrinfo.c                      | 4 ----
 src/test/interrupt.c                         | 1 -
 src/win32/mta_holder.h                       | 4 ----
 test/libvlc/media.c                          | 4 ----
 test/libvlc/media_player.c                   | 3 ---
 test/libvlc/slaves.c                         | 2 --
 22 files changed, 52 deletions(-)

diff --git a/include/vlc_cxx_helpers.hpp b/include/vlc_cxx_helpers.hpp
index 70a29b7bda..2f256016e5 100644
--- a/include/vlc_cxx_helpers.hpp
+++ b/include/vlc_cxx_helpers.hpp
@@ -376,7 +376,6 @@ public:
     }
     ~semaphore()
     {
-        vlc_sem_destroy( &m_sem );
     }
 
     semaphore( const semaphore& ) = delete;
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 584b6416b1..ab3a7e3cb5 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -569,11 +569,6 @@ int vlc_cond_timedwait_daytime(vlc_cond_t *, vlc_mutex_t *, time_t);
  */
 VLC_API void vlc_sem_init(vlc_sem_t *, unsigned count);
 
-/**
- * Deinitializes a semaphore.
- */
-VLC_API void vlc_sem_destroy(vlc_sem_t *);
-
 /**
  * Increments the value of a semaphore.
  *
diff --git a/modules/access/http/h2output_test.c b/modules/access/http/h2output_test.c
index 8027bab492..bc3b393e26 100644
--- a/modules/access/http/h2output_test.c
+++ b/modules/access/http/h2output_test.c
@@ -134,7 +134,6 @@ int main(void)
     out = vlc_h2_output_create(&fake_tls, expect_hello = true);
     assert(out != NULL);
     vlc_h2_output_destroy(out);
-    vlc_sem_destroy(&rx);
 
     /* Success */
     vlc_sem_init(&rx, 0);
@@ -156,7 +155,6 @@ int main(void)
     assert(vlc_h2_output_send(out, frame(9)) == 0);
 
     vlc_h2_output_destroy(out);
-    vlc_sem_destroy(&rx);
 
     /* Failure */
     send_failure = true;
@@ -172,7 +170,6 @@ int main(void)
     assert(vlc_h2_output_send(out, frame(0)) == -1);
     assert(vlc_h2_output_send_prio(out, frame(0)) == -1);
     vlc_h2_output_destroy(out);
-    vlc_sem_destroy(&rx);
 
     /* Failure during hello */
     vlc_sem_init(&rx, 0);
@@ -186,7 +183,6 @@ int main(void)
     assert(vlc_h2_output_send(out, frame(0)) == -1);
     assert(vlc_h2_output_send_prio(out, frame(0)) == -1);
     vlc_h2_output_destroy(out);
-    vlc_sem_destroy(&rx);
 
     return 0;
 }
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index e02e0c269c..f38490ea1d 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -134,7 +134,6 @@ ca_Close(audio_output_t *p_aout)
 {
     struct aout_sys_common *p_sys = (struct aout_sys_common *) p_aout->sys;
 
-    vlc_sem_destroy(&p_sys->flush_sem);
     lock_destroy(p_sys);
 }
 
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index 0f3ba6aacf..99903e0e7f 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -100,13 +100,11 @@ static int Open( vlc_object_t *p_this )
     if( vlc_clone( &p_intf->p_sys->thread, Run, p_intf,
                                VLC_THREAD_PRIORITY_LOW ) )
     {
-        vlc_sem_destroy( &p_intf->p_sys->init_wait );
         free( p_intf->p_sys );
         return VLC_EGENERIC;
     }
 
     vlc_sem_wait( &p_intf->p_sys->init_wait );
-    vlc_sem_destroy( &p_intf->p_sys->init_wait );
 
     if( p_intf->p_sys->b_error )
     {
diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index 2610964f0d..1d161c7847 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -449,7 +449,6 @@ static void conv_flush(filter_t * p_filter)
     pic_fifo_release_all(&sys->ret_pics);
 
     // Reset sem values - easiest & most reliable way is to just kill & re-init
-    vlc_sem_destroy(&sys->sem);
     vlc_sem_init(&sys->sem, 0);
     sys->pic_n = 0;
 
@@ -783,7 +782,6 @@ void CloseConverter(vlc_object_t * obj)
     if (sys->dec_dev)
         vlc_decoder_device_Release(sys->dec_dev);
 
-    vlc_sem_destroy(&sys->sem);
     vlc_mutex_destroy(&sys->lock);
 
     p_filter->p_sys = NULL;
diff --git a/modules/keystore/secret.c b/modules/keystore/secret.c
index d1f1e39acd..c590af7dc9 100644
--- a/modules/keystore/secret.c
+++ b/modules/keystore/secret.c
@@ -313,7 +313,6 @@ Open(vlc_object_t *p_this)
         vlc_sem_wait_i11e(&watch_data.sem);
 
         g_bus_unwatch_name(i_id);
-        vlc_sem_destroy(&watch_data.sem);
 
         if (!watch_data.b_running)
             return VLC_EGENERIC;
diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index 6bf0b249a1..a196860c13 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -112,7 +112,6 @@ PictureStreamOutputBuffer::PictureStreamOutputBuffer()
 
 PictureStreamOutputBuffer::~PictureStreamOutputBuffer()
 {
-    vlc_sem_destroy(&pool_semaphore);
 }
 
 void * PictureStreamOutputBuffer::Dequeue()
diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c
index 85d323f09b..a3a031d10c 100644
--- a/modules/stream_out/transcode/encoder/video.c
+++ b/modules/stream_out/transcode/encoder/video.c
@@ -444,7 +444,6 @@ void transcode_encoder_video_close( transcode_encoder_t *p_enc )
     p_enc->p_encoder->p_module = NULL;
 
     vlc_cond_destroy( &p_enc->cond );
-    vlc_sem_destroy( &p_enc->picture_pool_has_room );
 }
 
 int transcode_encoder_video_open( transcode_encoder_t *p_enc,
@@ -474,7 +473,6 @@ int transcode_encoder_video_open( transcode_encoder_t *p_enc,
         if( vlc_clone( &p_enc->thread, EncoderThread, p_enc, p_cfg->video.threads.i_priority ) )
         {
             vlc_cond_destroy( &p_enc->cond );
-            vlc_sem_destroy( &p_enc->picture_pool_has_room );
             module_unneed( p_enc->p_encoder, p_enc->p_encoder->p_module );
             p_enc->p_encoder->p_module = NULL;
             return VLC_EGENERIC;
diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
index 8d6532ceb4..43cccba061 100644
--- a/modules/video_output/splitter.c
+++ b/modules/video_output/splitter.c
@@ -127,7 +127,6 @@ static void vlc_vidsplit_Close(vout_display_t *vd)
 
         vout_window_Disable(part->window);
         vout_window_Delete(part->window);
-        vlc_sem_destroy(&part->lock);
     }
 
     module_unneed(&sys->splitter, sys->splitter.p_module);
@@ -295,7 +294,6 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
         if (display == NULL) {
             vout_window_Disable(part->window);
             vout_window_Delete(part->window);
-            vlc_sem_destroy(&part->lock);
             splitter->i_output = i;
             vlc_vidsplit_Close(vd);
             return VLC_EGENERIC;
diff --git a/modules/video_output/win32/window.c b/modules/video_output/win32/window.c
index ac4798a9b4..51ec5ff11a 100644
--- a/modules/video_output/win32/window.c
+++ b/modules/video_output/win32/window.c
@@ -470,7 +470,6 @@ static void Close(vout_window_t *wnd)
     if (sys->hwnd)
         PostMessage( sys->hwnd, WM_CLOSE, 0, 0 );
     vlc_join(sys->thread, NULL);
-    vlc_sem_destroy( &sys->ready );
     free(atomic_load(&sys->pwz_title));
 
     HINSTANCE hInstance = GetModuleHandle(NULL);
diff --git a/src/android/thread.c b/src/android/thread.c
index 950a814199..626e20b8e2 100644
--- a/src/android/thread.c
+++ b/src/android/thread.c
@@ -259,7 +259,6 @@ int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data,
 void vlc_join (vlc_thread_t handle, void **result)
 {
     vlc_sem_wait (&handle->finished);
-    vlc_sem_destroy (&handle->finished);
 
     int val = pthread_join (handle->thread, result);
     VLC_THREAD_ASSERT ("joining thread");
diff --git a/src/input/vlm.c b/src/input/vlm.c
index e40615a431..c63217c295 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -684,7 +684,6 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
                 }
                 vlc_player_Unlock(player);
                 vlc_player_Delete(player);
-                vlc_sem_destroy( &sem_preparse );
 
             }
 
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index befaab5151..fde14997b9 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -519,7 +519,6 @@ vlc_dialog_wait_question
 vlc_dialog_wait_question_va
 vlc_ext_dialog_update
 vlc_sem_init
-vlc_sem_destroy
 vlc_sem_post
 vlc_sem_wait
 vlc_control_cancel
diff --git a/src/linux/getaddrinfo.c b/src/linux/getaddrinfo.c
index bd32286d46..7c082d4e97 100644
--- a/src/linux/getaddrinfo.c
+++ b/src/linux/getaddrinfo.c
@@ -69,10 +69,7 @@ int vlc_getaddrinfo_i11e(const char *name, unsigned port,
 
     int val = getaddrinfo_a(GAI_NOWAIT, &(struct gaicb *){ &req }, 1, &sev);
     if (val)
-    {
-        vlc_sem_destroy(&done);
         return val;
-    }
 
     vlc_sem_wait_i11e(&done);
 
@@ -83,7 +80,6 @@ int vlc_getaddrinfo_i11e(const char *name, unsigned port,
 
     val = gai_error(&req);
     assert(val != EAI_INPROGRESS);
-    vlc_sem_destroy(&done);
 
     if (val == 0)
         *res = req.ar_result;
diff --git a/src/misc/threads.c b/src/misc/threads.c
index ccf002be62..df1a390c8e 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -402,11 +402,6 @@ void vlc_sem_init (vlc_sem_t *sem, unsigned value)
     atomic_init(&sem->value, value);
 }
 
-void vlc_sem_destroy (vlc_sem_t *sem)
-{
-    (void) sem;
-}
-
 int vlc_sem_post (vlc_sem_t *sem)
 {
     unsigned exp = atomic_load_explicit(&sem->value, memory_order_relaxed);
diff --git a/src/posix/getaddrinfo.c b/src/posix/getaddrinfo.c
index 7ce457e775..c7f9bf07b5 100644
--- a/src/posix/getaddrinfo.c
+++ b/src/posix/getaddrinfo.c
@@ -76,16 +76,12 @@ int vlc_getaddrinfo_i11e(const char *name, unsigned port,
     vlc_sem_init(&req.done, 0);
 
     if (vlc_clone(&th, vlc_gai_thread, &req, VLC_THREAD_PRIORITY_LOW))
-    {
-        vlc_sem_destroy(&req.done);
         return EAI_SYSTEM;
-    }
 
     vlc_sem_wait_i11e(&req.done);
 
     vlc_cancel(th);
     vlc_join(th, NULL);
-    vlc_sem_destroy(&req.done);
 
     return req.error;
 }
diff --git a/src/test/interrupt.c b/src/test/interrupt.c
index 2e6c7efa6a..808335575b 100644
--- a/src/test/interrupt.c
+++ b/src/test/interrupt.c
@@ -207,6 +207,5 @@ int main (void)
 
     vlc_close(fds[1]);
     vlc_close(fds[0]);
-    vlc_sem_destroy(&sem);
     return 0;
 }
diff --git a/src/win32/mta_holder.h b/src/win32/mta_holder.h
index 08ae78e2ca..dff4bfdfca 100644
--- a/src/win32/mta_holder.h
+++ b/src/win32/mta_holder.h
@@ -78,8 +78,6 @@ static inline bool vlc_mta_acquire( vlc_object_t *p_parent )
         p_mta->i_refcount = 1;
         if ( vlc_clone( &p_mta->thread, MtaMainLoop, p_mta, VLC_THREAD_PRIORITY_LOW ) )
         {
-            vlc_sem_destroy( &p_mta->release_sem );
-            vlc_sem_destroy( &p_mta->ready_sem );
             free( p_mta );
             p_mta = NULL;
             vlc_global_unlock( VLC_MTA_MUTEX );
@@ -116,8 +114,6 @@ static inline void vlc_mta_release( vlc_object_t* p_parent )
 
         vlc_join( p_mta->thread, NULL );
 
-        vlc_sem_destroy( &p_mta->release_sem );
-        vlc_sem_destroy( &p_mta->ready_sem );
         free( p_mta );
     }
 }
diff --git a/test/libvlc/media.c b/test/libvlc/media.c
index 726cf925df..020c03b22b 100644
--- a/test/libvlc/media.c
+++ b/test/libvlc/media.c
@@ -116,7 +116,6 @@ static void test_media_preparsed(libvlc_instance_t *vlc, const char *path,
 
     // Wait for preparsed event
     vlc_sem_wait (&sem);
-    vlc_sem_destroy (&sem);
 
     // We are good, now check Elementary Stream info.
     assert (libvlc_media_get_parsed_status(media) == i_expected_status);
@@ -173,7 +172,6 @@ static void test_input_metadata_timeout(libvlc_instance_t *vlc, int timeout,
     vlc_sem_wait(&sem);
 
     input_item_Release(p_item);
-    vlc_sem_destroy(&sem);
     vlc_close(p_pipe[0]);
     vlc_close(p_pipe[1]);
 }
@@ -267,8 +265,6 @@ static void test_media_subitems_media(libvlc_media_t *media, bool play,
         vlc_sem_wait (&sem);
     }
 
-    vlc_sem_destroy (&sem);
-
     if (!b_items_expected)
         return;
 
diff --git a/test/libvlc/media_player.c b/test/libvlc/media_player.c
index 56f847e05a..10f56abb9e 100644
--- a/test/libvlc/media_player.c
+++ b/test/libvlc/media_player.c
@@ -47,8 +47,6 @@ static void play_and_wait(libvlc_media_player_t *mp)
     vlc_sem_wait(&sem);
 
     libvlc_event_detach(em, libvlc_MediaPlayerPlaying, on_event, &sem);
-
-    vlc_sem_destroy(&sem);
 }
 
 static void pause_and_wait(libvlc_media_player_t *mp)
@@ -73,7 +71,6 @@ static void pause_and_wait(libvlc_media_player_t *mp)
         vlc_sem_wait(&sem);
     }
 
-    vlc_sem_destroy(&sem);
     libvlc_event_detach(em, libvlc_MediaPlayerPaused, on_event, &sem);
     libvlc_event_detach(em, libvlc_MediaPlayerEndReached, on_event, &sem);
 }
diff --git a/test/libvlc/slaves.c b/test/libvlc/slaves.c
index 7b2c24fa43..5863bf2ce4 100644
--- a/test/libvlc/slaves.c
+++ b/test/libvlc/slaves.c
@@ -48,8 +48,6 @@ media_parse_sync(libvlc_media_t *p_m)
     vlc_sem_wait (&sem);
 
     libvlc_event_detach(p_em, libvlc_MediaParsedChanged, finished_event, &sem);
-
-    vlc_sem_destroy (&sem);
 }
 
 static char *
-- 
2.25.0



More information about the vlc-devel mailing list