X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_threads.h;h=f025faef5b8737dfea109b3a4eb760df376e4c96;hb=caf6188518644f20b84536fca5af932de98ecd02;hp=c3c8b4fe9c56519d5605bb8032cc45df60c44ff0;hpb=fbb8255dcf8ced858d59927cb17c4f577a8d9c15;p=vlc diff --git a/include/vlc_threads.h b/include/vlc_threads.h index c3c8b4fe9c..f025faef5b 100644 --- a/include/vlc_threads.h +++ b/include/vlc_threads.h @@ -58,12 +58,12 @@ /* Thread priorities */ #ifdef __APPLE__ -# define VLC_THREAD_PRIORITY_LOW (-47) -# define VLC_THREAD_PRIORITY_INPUT 37 -# define VLC_THREAD_PRIORITY_AUDIO 37 -# define VLC_THREAD_PRIORITY_VIDEO (-47) -# define VLC_THREAD_PRIORITY_OUTPUT 37 -# define VLC_THREAD_PRIORITY_HIGHEST 37 +# define VLC_THREAD_PRIORITY_LOW 0 +# define VLC_THREAD_PRIORITY_INPUT 22 +# define VLC_THREAD_PRIORITY_AUDIO 22 +# define VLC_THREAD_PRIORITY_VIDEO 0 +# define VLC_THREAD_PRIORITY_OUTPUT 22 +# define VLC_THREAD_PRIORITY_HIGHEST 22 #elif defined(SYS_BEOS) # define VLC_THREAD_PRIORITY_LOW 5 @@ -171,9 +171,10 @@ VLC_EXPORT( int, vlc_threadvar_create, (vlc_threadvar_t * , void (*) (void *) ) VLC_EXPORT( void, vlc_threadvar_delete, (vlc_threadvar_t *) ); VLC_EXPORT( int, __vlc_thread_create, ( vlc_object_t *, const char *, int, const char *, void * ( * ) ( void * ), int, bool ) ); VLC_EXPORT( int, __vlc_thread_set_priority, ( vlc_object_t *, const char *, int, int ) ); -VLC_EXPORT( void, __vlc_thread_ready, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_thread_join, ( vlc_object_t *, const char *, int ) ); +#define vlc_thread_ready vlc_object_signal + /***************************************************************************** * vlc_mutex_lock: lock a mutex *****************************************************************************/ @@ -559,6 +560,31 @@ static inline int vlc_spin_init (vlc_spinlock_t *spin) # define vlc_spin_destroy vlc_mutex_destroy #endif +/** + * Issues a full memory barrier. + */ +#if defined (__APPLE__) +# include /* OSMemoryBarrier() */ +#endif +static inline void barrier (void) +{ +#if defined (__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) + __sync_synchronize (); +#elif defined(__APPLE__) + OSMemoryBarrier (); +#elif defined(__powerpc__) + asm volatile ("sync":::"memory"); +#elif defined(__i386__) + asm volatile ("mfence":::"memory"); +#elif defined (LIBVLC_USE_PTHREAD) + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_lock (&lock); + pthread_mutex_unlock (&lock); +#else +# error barrier not implemented! +#endif +} + /***************************************************************************** * vlc_thread_create: create a thread *****************************************************************************/ @@ -571,12 +597,6 @@ static inline int vlc_spin_init (vlc_spinlock_t *spin) #define vlc_thread_set_priority( P_THIS, PRIORITY ) \ __vlc_thread_set_priority( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PRIORITY ) -/***************************************************************************** - * vlc_thread_ready: tell the parent thread we were successfully spawned - *****************************************************************************/ -#define vlc_thread_ready( P_THIS ) \ - __vlc_thread_ready( VLC_OBJECT(P_THIS) ) - /***************************************************************************** * vlc_thread_join: wait until a thread exits *****************************************************************************/