[vlc-devel] [PATCH] vlc_threads: remove unused vlc_thread_self / vlc_thread_equal / vlc_osthread_t

Steve Lhomme robux4 at ycbcr.xyz
Mon Mar 2 14:48:22 CET 2020


Oops.

On 2020-03-02 14:44, Rémi Denis-Courmont wrote:
> Okay except for removing vlc_thread_id() in OS/2 code.
> 
> Le 2 mars 2020 15:23:00 GMT+02:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
> 
>     ------------------------------------------------------------------------
>       include/vlc_threads.h | 35 -----------------------------------
>       src/android/thread.c  |  5 -----
>       src/darwin/thread.c   |  5 -----
>       src/libvlccore.sym    |  1 -
>       src/os2/thread.c      | 10 ----------
>       src/posix/thread.c    |  5 -----
>       src/win32/thread.c    |  5 -----
>       7 files changed, 66 deletions(-)
> 
>     diff --git a/include/vlc_threads.h b/include/vlc_threads.h
>     index cc99db97668..131e3196226 100644
>     --- a/include/vlc_threads.h
>     +++ b/include/vlc_threads.h
>     @@ -59,9 +59,6 @@ VLC_API void vlc_testcancel(void);
>       typedef struct vlc_thread *vlc_thread_t;
>       # define VLC_THREAD_CANCELED NULL
>       
>     -typedef unsigned long vlc_osthread_t;
>     -#define vlc_thread_equal(a,b) ((a) == (b))
>     -
>       # define LIBVLC_NEED_SLEEP
>       #define LIBVLC_NEED_RWLOCK
>       typedef INIT_ONCE vlc_once_t;
>     @@ -94,9 +91,6 @@ static inline int vlc_poll(struct pollfd *fds, unsigned nfds, int timeout)
>       typedef struct vlc_thread *vlc_thread_t;
>       #define VLC_THREAD_CANCELED NULL
>       
>     -typedef unsigned long vlc_osthread_t;
>     -#define vlc_thread_equal(a,b) ((a) == (b))
>     -
>       #define LIBVLC_NEED_RWLOCK
>       typedef struct
>       {
>     @@ -148,8 +142,6 @@ static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
>       
>       typedef struct vlc_thread *vlc_thread_t;
>       #define VLC_THREAD_CANCELED NULL
>     -typedef pthread_t vlc_osthread_t;
>     -#define vlc_thread_equal(a,b) pthread_equal(a,b)
>       typedef pthread_once_t  vlc_once_t;
>       #define VLC_STATIC_ONCE   PTHREAD_ONCE_INIT
>       typedef pthread_key_t   vlc_threadvar_t;
>     @@ -193,8 +185,6 @@ static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
>       
>       typedef pthread_t       vlc_thread_t;
>       #define VLC_THREAD_CANCELED PTHREAD_CANCELED
>     -typedef pthread_t       vlc_osthread_t;
>     -#define vlc_thread_equal(a,b) pthread_equal(a,b)
>       typedef pthread_rwlock_t vlc_rwlock_t;
>       #define VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER
>       typedef pthread_once_t  vlc_once_t;
>     @@ -236,9 +226,6 @@ typedef struct
>        */
>       #define VLC_THREAD_CANCELED PTHREAD_CANCELED
>       
>     -typedef pthread_t vlc_osthread_t;
>     -#define vlc_thread_equal(a,b) pthread_equal(a,b)
>     -
>       /**
>        * Read/write lock.
>        *
>     @@ -842,26 +829,6 @@ typedef struct vlc_cleanup_t vlc_cleanup_t;
>        */
>       VLC_API void vlc_control_cancel(vlc_cleanup_t *);
>       
>     -/**
>     - * Thread handle.
>     - *
>     - * This function returns the thread handle of the calling thread.
>     - * This works even if the thread was <b>not</b> created with vlc_clone().
>     - * As a consequence, depending on the platform, this might or might not be the
>     - * same as the @ref vlc_thread_t thread handle returned by vlc_clone().
>     - *
>     - * Also depending on the platform, this might be an integer type, a pointer
>     - * type, or a compound type of any (reasonable) size. To compare two thread
>     - * handles, use the vlc_thread_equal() macro, not a hand-coded comparison.
>     - * Comparing the calling thread for equality with another thread is in fact
>     - * pretty much the only purpose of this function.
>     - *
>     - * \note If you need an integer identifier, use vlc_thread_id() instead.
>     - *
>     - * \return the OS run-time thread handle
>     - */
>     -VLC_API vlc_osthread_t vlc_thread_self(void) VLC_USED;
>     -
>       /**
>        * Thread identifier.
>        *
>     @@ -874,8 +841,6 @@ VLC_API vlc_osthread_t vlc_thread_self(void) VLC_USED;
>        * There are no particular semantics to the thread ID with LibVLC.
>        * It is provided mainly for tracing and debugging.
>        *
>     - * See also vlc_thread_self().
>     - *
>        * \warning This function is not currently implemented on all supported
>        * platforms. Where not implemented, it returns (unsigned long)-1.
>        *
>     diff --git a/src/android/thread.c b/src/android/thread.c
>     index 69ec70c25db..f831f5b5c11 100644
>     --- a/src/android/thread.c
>     +++ b/src/android/thread.c
>     @@ -92,11 +92,6 @@ struct vlc_thread
>       
>       static thread_local struct vlc_thread *thread = NULL;
>       
>     -pthread_t vlc_thread_self(void)
>     -{
>     -    return pthread_self();
>     -}
>     -
>       void vlc_threads_setup (libvlc_int_t *p_libvlc)
>       {
>           (void)p_libvlc;
>     diff --git a/src/darwin/thread.c b/src/darwin/thread.c
>     index 7e7de3d815e..13ccbeed2de 100644
>     --- a/src/darwin/thread.c
>     +++ b/src/darwin/thread.c
>     @@ -238,11 +238,6 @@ int vlc_clone_detach (vlc_thread_t *th, void *(*entry) (void *), void *data,
>           return vlc_clone_attr (th, &attr, entry, data, priority);
>       }
>       
>     -vlc_thread_t vlc_thread_self (void)
>     -{
>     -    return pthread_self ();
>     -}
>     -
>       unsigned long vlc_thread_id (void)
>       {
>           return -1;
>     diff --git a/src/libvlccore.sym b/src/libvlccore.sym
>     index 0f60077bb2b..caf42878421 100644
>     --- a/src/libvlccore.sym
>     +++ b/src/libvlccore.sym
>     @@ -644,7 +644,6 @@ vlc_sd_GetNames
>       vlc_sd_probe_Add
>       vlc_sdp_Start
>       vlc_testcancel
>     -vlc_thread_self
>       vlc_thread_id
>       vlc_threadvar_create
>       vlc_threadvar_delete
>     diff --git a/src/os2/thread.c b/src/os2/thread.c
>     index b732e9fb6e1..536e4128e64 100644
>     --- a/src/os2/thread.c
>     +++ b/src/os2/thread.c
>     @@ -406,16 +406,6 @@ int vlc_set_priority (vlc_thread_t th, int priority)
>           return VLC_SUCCESS;
>       }
>       
>     -unsigned long vlc_thread_self(void)
>     -{
>     -    return vlc_thread_id();
>     -}
>     -
>     -unsigned long vlc_thread_id (void)
>     -{
>     -    return _gettid();
>     -}
>     -
>       /*** Thread cancellation ***/
>       
>       /* APC procedure for thread cancellation */
>     diff --git a/src/posix/thread.c b/src/posix/thread.c
>     index 32d48b5cc26..27a4a49a98e 100644
>     --- a/src/posix/thread.c
>     +++ b/src/posix/thread.c
>     @@ -316,11 +316,6 @@ int vlc_clone_detach (vlc_thread_t *th, void *(*entry) (void *), void *data,
>           return vlc_clone_attr (th, &attr, entry, data, priority);
>       }
>       
>     -pthread_t vlc_thread_self(void)
>     -{
>     -    return pthread_self();
>     -}
>     -
>       VLC_WEAK unsigned long vlc_thread_id(void)
>       {
>            return -1;
>     diff --git a/src/win32/thread.c b/src/win32/thread.c
>     index 3292936321a..18fa754ea89 100644
>     --- a/src/win32/thread.c
>     +++ b/src/win32/thread.c
>     @@ -451,11 +451,6 @@ int vlc_clone_detach (vlc_thread_t *p_handle, void *(*entry) (void *),
>           return vlc_clone_attr (p_handle, true, entry, data, priority);
>       }
>       
>     -unsigned long vlc_thread_self(void)
>     -{
>     -    return GetCurrentThreadId();
>     -}
>     -
>       unsigned long vlc_thread_id (void)
>       {
>           return GetCurrentThreadId ();
> 
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser 
> ma brièveté.
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list