Commit eae53f7c authored by Eric Petit's avatar Eric Petit

+ modules/misc/freetype.c: fixed a couple of typos

 + *threads*, src/libvlc.h:
   test HAVE_KERNEL_SCHEDULER_H before PTHREAD_COND_T_IN_PTHREAD_H
   for now because Zeta now has a pthread implementation but it's doesn't
   seem to be (enough) POSIX compliant atm.
parent 09d99720
......@@ -3,7 +3,7 @@
* This header provides portable declarations for mutexes & conditions
*****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN
* $Id: vlc_threads.h,v 1.35 2003/11/07 19:30:28 massiot Exp $
* $Id: vlc_threads.h,v 1.36 2003/11/22 00:41:07 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -14,7 +14,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -42,6 +42,11 @@
#elif defined( WIN32 )
# include <process.h> /* Win32 API */
#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* BeOS */
# include <kernel/OS.h>
# include <kernel/scheduler.h>
# include <byteorder.h>
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) /* pthreads (like Linux & BSD) */
# include <pthread.h>
# ifdef DEBUG
......@@ -54,11 +59,6 @@
#elif defined( HAVE_CTHREADS_H ) /* GNUMach */
# include <cthreads.h>
#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* BeOS */
# include <kernel/OS.h>
# include <kernel/scheduler.h>
# include <byteorder.h>
#else
# error no threads available on your system !
......@@ -76,6 +76,13 @@
# define VLC_THREAD_PRIORITY_VIDEO (-47)
# define VLC_THREAD_PRIORITY_OUTPUT 37
#elif defined(SYS_BEOS)
# define VLC_THREAD_PRIORITY_LOW 5
# define VLC_THREAD_PRIORITY_INPUT 10
# define VLC_THREAD_PRIORITY_AUDIO 10
# define VLC_THREAD_PRIORITY_VIDEO 5
# define VLC_THREAD_PRIORITY_OUTPUT 15
#elif defined(PTHREAD_COND_T_IN_PTHREAD_H)
# define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_INPUT 20
......@@ -97,13 +104,6 @@
# define VLC_THREAD_PRIORITY_HIGHEST \
(IS_WINNT ? THREAD_PRIORITY_TIME_CRITICAL : 0)
#elif defined(SYS_BEOS)
# define VLC_THREAD_PRIORITY_LOW 5
# define VLC_THREAD_PRIORITY_INPUT 10
# define VLC_THREAD_PRIORITY_AUDIO 10
# define VLC_THREAD_PRIORITY_VIDEO 5
# define VLC_THREAD_PRIORITY_OUTPUT 15
#else
# define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_INPUT 0
......@@ -172,6 +172,29 @@ typedef struct
vlc_object_t * p_this;
} vlc_cond_t;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
/* This is the BeOS implementation of the vlc threads, note that the mutex is
* not a real mutex and the cond_var is not like a pthread cond_var but it is
* enough for what wee need */
typedef thread_id vlc_thread_t;
typedef struct
{
int32_t init;
sem_id lock;
vlc_object_t * p_this;
} vlc_mutex_t;
typedef struct
{
int32_t init;
thread_id thread;
vlc_object_t * p_this;
} vlc_cond_t;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
typedef pthread_t vlc_thread_t;
typedef struct
......@@ -211,28 +234,5 @@ typedef struct
vlc_object_t * p_this;
} vlc_cond_t;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
/* This is the BeOS implementation of the vlc threads, note that the mutex is
* not a real mutex and the cond_var is not like a pthread cond_var but it is
* enough for what wee need */
typedef thread_id vlc_thread_t;
typedef struct
{
int32_t init;
sem_id lock;
vlc_object_t * p_this;
} vlc_mutex_t;
typedef struct
{
int32_t init;
thread_id thread;
vlc_object_t * p_this;
} vlc_cond_t;
#endif
......@@ -3,7 +3,7 @@
* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN
* $Id: vlc_threads_funcs.h,v 1.15 2003/03/02 01:35:30 gbazin Exp $
* $Id: vlc_threads_funcs.h,v 1.16 2003/11/22 00:41:07 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -93,18 +93,6 @@ static inline int __vlc_mutex_lock( char * psz_file, int i_line,
}
i_result = 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_mutex_lock( &p_mutex->mutex );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
mutex_lock( p_mutex->mutex );
i_result = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_mutex == NULL )
{
......@@ -118,6 +106,19 @@ static inline int __vlc_mutex_lock( char * psz_file, int i_line,
{
i_result = acquire_sem( p_mutex->lock );
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_mutex_lock( &p_mutex->mutex );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
mutex_lock( p_mutex->mutex );
i_result = 0;
#endif
if( i_result )
......@@ -164,18 +165,6 @@ static inline int __vlc_mutex_unlock( char * psz_file, int i_line,
}
i_result = 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_mutex_unlock( &p_mutex->mutex );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
mutex_unlock( p_mutex );
i_result = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_mutex == NULL )
{
......@@ -190,6 +179,19 @@ static inline int __vlc_mutex_unlock( char * psz_file, int i_line,
release_sem( p_mutex->lock );
return B_OK;
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_mutex_unlock( &p_mutex->mutex );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
mutex_unlock( p_mutex );
i_result = 0;
#endif
if( i_result )
......@@ -279,22 +281,6 @@ static inline int __vlc_cond_signal( char * psz_file, int i_line,
}
i_result = 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_cond_signal( &p_condvar->cond );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
/* condition_signal() */
if ( p_condvar->queue.head || p_condvar->implications )
{
cond_signal( (condition_t)p_condvar );
}
i_result = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_condvar == NULL )
{
......@@ -331,6 +317,23 @@ static inline int __vlc_cond_signal( char * psz_file, int i_line,
}
i_result = 0;
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_cond_signal( &p_condvar->cond );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
/* condition_signal() */
if ( p_condvar->queue.head || p_condvar->implications )
{
cond_signal( (condition_t)p_condvar );
}
i_result = 0;
#endif
if( i_result )
......@@ -425,22 +428,6 @@ static inline int __vlc_cond_broadcast( char * psz_file, int i_line,
}
i_result = 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_cond_broadcast( &p_condvar->cond );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
/* condition_signal() */
if ( p_condvar->queue.head || p_condvar->implications )
{
cond_signal( (condition_t)p_condvar );
}
i_result = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_condvar == NULL )
{
......@@ -477,6 +464,23 @@ static inline int __vlc_cond_broadcast( char * psz_file, int i_line,
}
i_result = 0;
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_cond_broadcast( &p_condvar->cond );
if ( i_result )
{
i_thread = (int)pthread_self();
psz_error = strerror(i_result);
}
#elif defined( HAVE_CTHREADS_H )
/* condition_signal() */
if ( p_condvar->queue.head || p_condvar->implications )
{
cond_signal( (condition_t)p_condvar );
}
i_result = 0;
#endif
if( i_result )
......@@ -599,6 +603,31 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line,
i_result = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_condvar == NULL )
{
i_result = B_BAD_VALUE;
}
else if( p_mutex == NULL )
{
i_result = B_BAD_VALUE;
}
else if( p_condvar->init < 2000 )
{
i_result = B_NO_INIT;
}
/* The p_condvar->thread var is initialized before the unlock because
* it enables to identify when the thread is interrupted beetwen the
* unlock line and the suspend_thread line */
p_condvar->thread = find_thread( NULL );
vlc_mutex_unlock( p_mutex );
suspend_thread( p_condvar->thread );
p_condvar->thread = -1;
vlc_mutex_lock( p_mutex );
i_result = 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
# ifdef DEBUG
......@@ -638,31 +667,6 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line,
condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex );
i_result = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_condvar == NULL )
{
i_result = B_BAD_VALUE;
}
else if( p_mutex == NULL )
{
i_result = B_BAD_VALUE;
}
else if( p_condvar->init < 2000 )
{
i_result = B_NO_INIT;
}
/* The p_condvar->thread var is initialized before the unlock because
* it enables to identify when the thread is interrupted beetwen the
* unlock line and the suspend_thread line */
p_condvar->thread = find_thread( NULL );
vlc_mutex_unlock( p_mutex );
suspend_thread( p_condvar->thread );
p_condvar->thread = -1;
vlc_mutex_lock( p_mutex );
i_result = 0;
#endif
if( i_result )
......
......@@ -2,7 +2,7 @@
* freetype.c : Put text on the video, using freetype2
*****************************************************************************
* Copyright (C) 2002, 2003 VideoLAN
* $Id: freetype.c,v 1.34 2003/11/19 13:25:48 hartman Exp $
* $Id: freetype.c,v 1.35 2003/11/22 00:41:07 titer Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -94,7 +94,7 @@ static line_desc_t *NewLine( byte_t * );
#define FONTSIZER_TEXT N_("Font size")
#define FONTSIZER_LONGTEXT N_("The size of the fonts used by the osd module" )
static int *pi_sizes[] = { 20, 18, 16, 12, 6 };
static int pi_sizes[] = { 20, 18, 16, 12, 6 };
static char *ppsz_sizes_text[] = { N_("Smaller"), N_("Small"), N_("Normal"),
N_("Large"), N_("Larger") };
......@@ -250,7 +250,7 @@ static int Create( vlc_object_t *p_this )
FT_HAS_KERNING(p_vout->p_text_renderer_data->p_face);
var_Get( p_vout, "freetype-fontsize", &val );
if( val.i_int )
{
i_fontsize = val.i_int;
......@@ -472,7 +472,7 @@ static void RenderYUY2( vout_thread_t *p_vout, picture_t *p_pic,
int i_pic_width = p_pic->p[0].i_visible_pitch;
p_in = p_pic->p[0].p_pixels;
if ( p_string->i_flags & OSD_ALIGN_BOTTOM )
{
pen_y = p_pic->p[0].i_lines - p_string->i_height -
......@@ -496,7 +496,7 @@ static void RenderYUY2( vout_thread_t *p_vout, picture_t *p_pic,
{
pen_x = i_pic_width / 2 /2 - p_line->i_width / 2 + p_string->i_x_margin;
}
for( i = 0; p_line->pp_glyphs[i] != NULL; i++ )
{
FT_BitmapGlyph p_glyph = p_line->pp_glyphs[ i ];
......@@ -543,7 +543,7 @@ static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
line_desc_t *p_line;
i_plane = 0;
for( p_line = p_subpic->p_sys->p_lines; p_line != NULL; p_line = p_line->p_next )
{
uint8_t *p_in;
......@@ -551,7 +551,7 @@ static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
int i_pic_width = p_pic->p[ i_plane ].i_visible_pitch;
p_in = p_pic->p[ i_plane ].p_pixels;
if ( p_string->i_flags & OSD_ALIGN_BOTTOM )
{
pen_y = p_pic->p[ i_plane ].i_lines - p_string->i_height -
......@@ -576,7 +576,7 @@ static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
pen_x = i_pic_width / 2 / 4 - p_line->i_width / 2
+ p_string->i_x_margin;
}
for( i = 0; p_line->pp_glyphs[i] != NULL; i++ )
{
FT_BitmapGlyph p_glyph = p_line->pp_glyphs[ i ];
......@@ -640,7 +640,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
uint32_t *p_unicode_string, i_char;
int i_string_length;
iconv_t iconv_handle;
FT_BBox line;
FT_BBox glyph_size;
FT_Vector result;
......@@ -706,7 +706,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
}
#if defined(WORDS_BIGENDIAN)
iconv_handle = iconv_open( "UCS-4BE", "UTF-8" );
#else
#else
iconv_handle = iconv_open( "UCS-4LE", "UTF-8" );
#endif
if( iconv_handle == (iconv_t)-1 )
......@@ -732,7 +732,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
*(uint32_t*)p_out_buffer = 0;
i_string_length = ( i_out_bytes - i_out_bytes_left ) / sizeof(uint32_t);
}
#if defined(HAVE_FRIBIDI)
{
uint32_t *p_fribidi_string;
......@@ -747,7 +747,7 @@ static int AddText ( vout_thread_t *p_vout, byte_t *psz_string,
}
#endif
#endif
/* Calculate relative glyph positions and a bounding box for the
* entire string */
p_line = NewLine( psz_string );
......@@ -876,7 +876,7 @@ static void FreeString( subpicture_t *p_subpic )
free( p_line->p_glyph_pos );
free( p_line );
}
free( p_string->psz_text );
free( p_string );
}
......
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.107 2003/11/16 21:07:31 gbazin Exp $
* $Id: libvlc.h,v 1.108 2003/11/22 00:41:07 titer Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -428,7 +428,7 @@ static char *ppsz_language_text[] =
#define PLAYLIST_CAT_LONGTEXT N_( \
"These options define the behaviour of the playlist. Some " \
"of them can be overriden in the playlist dialog box." )
"of them can be overriden in the playlist dialog box." )
#define RANDOM_TEXT N_("Play files randomly forever")
#define RANDOM_LONGTEXT N_( \
......@@ -439,7 +439,7 @@ static char *ppsz_language_text[] =
#define LOOP_LONGTEXT N_( \
"If you want VLC to keep playing the playlist indefinitely then enable " \
"this option.")
#define REPEAT_TEXT N_("Repeat the current playlistitem")
#define REPEAT_LONGTEXT N_( \
"When this is active VLC will keep playing the current playlistitem " \
......@@ -593,7 +593,7 @@ vlc_module_begin();
add_module( "intf", "interface", NULL, NULL, INTF_TEXT,
INTF_LONGTEXT, VLC_TRUE );
change_short('I');
add_string( "extraintf", NULL, NULL, EXTRAINTF_TEXT,
add_string( "extraintf", NULL, NULL, EXTRAINTF_TEXT,
EXTRAINTF_LONGTEXT, VLC_FALSE );
add_integer( "verbose", 0, NULL, VERBOSE_TEXT, VERBOSE_LONGTEXT,
VLC_FALSE );
......@@ -604,9 +604,9 @@ vlc_module_begin();
VLC_FALSE );
change_string_list( ppsz_language, ppsz_language_text, 0 );
add_bool( "color", 0, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
add_bool( "advanced", 0, NULL, ADVANCED_TEXT,
add_bool( "advanced", 0, NULL, ADVANCED_TEXT,
ADVANCED_LONGTEXT, VLC_FALSE );
add_directory( "search-path", NULL, NULL, INTF_PATH_TEXT,
add_directory( "search-path", NULL, NULL, INTF_PATH_TEXT,
INTF_PATH_LONGTEXT, VLC_TRUE );
add_directory( "plugin-path", NULL, NULL,
PLUGIN_PATH_TEXT, PLUGIN_PATH_LONGTEXT, VLC_TRUE );
......@@ -629,13 +629,13 @@ vlc_module_begin();
#endif
add_bool( "spdif", 0, NULL, SPDIF_TEXT, SPDIF_LONGTEXT, VLC_FALSE );
#if 0
add_bool( "headphone-opt", 0, NULL, HEADPHONE_TEXT,
add_bool( "headphone-opt", 0, NULL, HEADPHONE_TEXT,
HEADPHONE_LONGTEXT, VLC_FALSE );
#endif
add_integer( "audio-desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT, VLC_TRUE );
add_string("audio-filter",0,NULL,AUDIO_FILTER_TEXT,
AUDIO_FILTER_LONGTEXT,VLC_FALSE);
/* Video options */
add_category_hint( N_("Video"), VOUT_CAT_LONGTEXT , VLC_FALSE );
add_module( "vout", "video output", NULL, NULL, VOUT_TEXT, VOUT_LONGTEXT,
......@@ -647,12 +647,12 @@ vlc_module_begin();
add_integer( "align", -1, NULL, ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE );
add_float( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT, VLC_TRUE );
add_bool( "grayscale", 0, NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT, VLC_TRUE );
add_bool( "fullscreen", 0, NULL, FULLSCREEN_TEXT,
add_bool( "fullscreen", 0, NULL, FULLSCREEN_TEXT,
FULLSCREEN_LONGTEXT, VLC_FALSE );
#ifndef SYS_DARWIN
add_bool( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT, VLC_TRUE );
#endif
add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT,
add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT,
SPUMARGIN_LONGTEXT, VLC_TRUE );
add_bool( "osd", 1, NULL, OSD_TEXT, OSD_LONGTEXT, VLC_FALSE );
add_module( "filter", "video filter", NULL, NULL,
......@@ -703,19 +703,19 @@ vlc_module_begin();
/* Stream output options */
add_category_hint( N_("Stream output"), SOUT_CAT_LONGTEXT , VLC_TRUE );
add_string( "sout", NULL, NULL, SOUT_TEXT, SOUT_LONGTEXT, VLC_TRUE );
add_bool( "sout-display", VLC_FALSE, NULL, SOUT_DISPLAY_TEXT,
add_bool( "sout-display", VLC_FALSE, NULL, SOUT_DISPLAY_TEXT,
SOUT_DISPLAY_LONGTEXT, VLC_TRUE );
add_bool( "sout-keep", VLC_FALSE, NULL, SOUT_KEEP_TEXT,
add_bool( "sout-keep", VLC_FALSE, NULL, SOUT_KEEP_TEXT,
SOUT_KEEP_LONGTEXT, VLC_TRUE );
add_bool( "sout-audio", 1, NULL, SOUT_AUDIO_TEXT,
add_bool( "sout-audio", 1, NULL, SOUT_AUDIO_TEXT,
SOUT_AUDIO_LONGTEXT, VLC_TRUE );
add_bool( "sout-video", 1, NULL, SOUT_VIDEO_TEXT,
add_bool( "sout-video", 1, NULL, SOUT_VIDEO_TEXT,
SOUT_VIDEO_LONGTEXT, VLC_TRUE );
add_module( "packetizer", "packetizer", NULL, NULL,
PACKETIZER_TEXT, PACKETIZER_LONGTEXT, VLC_TRUE );
add_module( "mux", "sout mux", NULL, NULL, MUX_TEXT,
add_module( "mux", "sout mux", NULL, NULL, MUX_TEXT,
MUX_LONGTEXT, VLC_TRUE );
add_module( "access_output", "sout access", NULL, NULL,
ACCESS_OUTPUT_TEXT, ACCESS_OUTPUT_LONGTEXT, VLC_TRUE );
......@@ -749,7 +749,7 @@ vlc_module_begin();
add_module( "access", "access", NULL, NULL, ACCESS_TEXT, ACCESS_LONGTEXT, VLC_TRUE );
add_module( "demux", "demux", NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT, VLC_TRUE );
#if !defined(SYS_DARWIN) && defined(PTHREAD_COND_T_IN_PTHREAD_H)
#if !defined(SYS_DARWIN) && !defined(SYS_BEOS) && defined(PTHREAD_COND_T_IN_PTHREAD_H)
add_bool( "rt-priority", 0, NULL, RT_PRIORITY_TEXT, RT_PRIORITY_LONGTEXT, VLC_TRUE );
#endif
......
......@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002, 2003 VideoLAN
* $Id: threads.c,v 1.43 2003/11/07 19:30:28 massiot Exp $
* $Id: threads.c,v 1.44 2003/11/22 00:41:07 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -41,10 +41,10 @@ static volatile int i_initializations = 0;
#elif defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#elif defined( WIN32 )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER;
#elif defined( HAVE_CTHREADS_H )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#endif
/*****************************************************************************
......@@ -81,10 +81,10 @@ int __vlc_threads_init( vlc_object_t *p_this )
#elif defined( UNDER_CE )
#elif defined( WIN32 )
HINSTANCE hInstLib;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_mutex_lock( &once_mutex );
#elif defined( HAVE_CTHREADS_H )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#endif
if( i_status == VLC_THREADS_UNINITIALIZED )
......@@ -124,9 +124,9 @@ int __vlc_threads_init( vlc_object_t *p_this )
p_libvlc->b_fast_mutex = 0;
p_libvlc->i_win9x_cv = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
#elif defined( HAVE_CTHREADS_H )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#endif
vlc_object_create( p_libvlc, VLC_OBJECT_ROOT );
......@@ -157,12 +157,12 @@ int __vlc_threads_init( vlc_object_t *p_this )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#elif defined( WIN32 )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_mutex_unlock( &once_mutex );
#elif defined( HAVE_CTHREADS_H )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
while( i_status == VLC_THREADS_PENDING ) msleep( THREAD_SLEEP );
#endif
if( i_status != VLC_THREADS_READY )
......@@ -197,6 +197,9 @@ int __vlc_threads_end( vlc_object_t *p_this )
#elif defined( WIN32 )
i_initializations--;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
i_initializations--;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
pthread_mutex_lock( &once_mutex );
i_initializations--;
......@@ -205,9 +208,6 @@ int __vlc_threads_end( vlc_object_t *p_this )
#elif defined( HAVE_CTHREADS_H )
i_initializations--;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
i_initializations--;
#endif
return VLC_SUCCESS;
}
......@@ -249,26 +249,6 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
return 0;
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
# if defined(DEBUG) && defined(SYS_LINUX)
{
/* Create error-checking mutex to detect problems more easily. */
pthread_mutexattr_t attr;
int i_result;
pthread_mutexattr_init( &attr );
pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_ERRORCHECK_NP );
i_result = pthread_mutex_init( &p_mutex->mutex, &attr );
pthread_mutexattr_destroy( &attr );
return( i_result );
}
# endif
return pthread_mutex_init( &p_mutex->mutex, NULL );
#elif defined( HAVE_CTHREADS_H )
mutex_init( p_mutex );
return 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
/* check the arguments and whether it's already been initialized */
if( p_mutex == NULL )
......@@ -290,6 +270,26 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
p_mutex->init = 9999;
return B_OK;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
# if defined(DEBUG) && defined(SYS_LINUX)
{
/* Create error-checking mutex to detect problems more easily. */
pthread_mutexattr_t attr;
int i_result;
pthread_mutexattr_init( &attr );
pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_ERRORCHECK_NP );
i_result = pthread_mutex_init( &p_mutex->mutex, &attr );
pthread_mutexattr_destroy( &attr );
return( i_result );
}
# endif
return pthread_mutex_init( &p_mutex->mutex, NULL );
#elif defined( HAVE_CTHREADS_H )
mutex_init( p_mutex );
return 0;
#endif
}
......@@ -324,6 +324,15 @@ int __vlc_mutex_destroy( char * psz_file, int i_line, vlc_mutex_t *p_mutex )
}
return 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_mutex->init == 9999 )
{
delete_sem( p_mutex->lock );
}
p_mutex->init = 0;
return B_OK;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_mutex_destroy( &p_mutex->mutex );
if ( i_result )
......@@ -335,14 +344,6 @@ int __vlc_mutex_destroy( char * psz_file, int i_line, vlc_mutex_t *p_mutex )
#elif defined( HAVE_CTHREADS_H )
return 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_mutex->init == 9999 )
{
delete_sem( p_mutex->lock );
}
p_mutex->init = 0;
return B_OK;
#endif
if( i_result )
......@@ -418,18 +419,6 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
return !p_condvar->semaphore || !p_condvar->event;
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
return pthread_cond_init( &p_condvar->cond, NULL );
#elif defined( HAVE_CTHREADS_H )
/* condition_init() */
spin_lock_init( &p_condvar->lock );
cthread_queue_init( &p_condvar->queue );
p_condvar->name = 0;
p_condvar->implications = 0;
return 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( !p_condvar )
{
......@@ -444,6 +433,19 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
p_condvar->thread = -1;
p_condvar->init = 9999;
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
return pthread_cond_init( &p_condvar->cond, NULL );
#elif defined( HAVE_CTHREADS_H )
/* condition_init() */
spin_lock_init( &p_condvar->lock );
cthread_queue_init( &p_condvar->queue );
p_condvar->name = 0;
p_condvar->implications = 0;
return 0;
#endif
}
......@@ -473,6 +475,10 @@ int __vlc_cond_destroy( char * psz_file, int i_line, vlc_cond_t *p_condvar )
i_result = !CloseHandle( p_condvar->event )
|| !CloseHandle( p_condvar->semaphore );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_condvar->init = 0;
return 0;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_result = pthread_cond_destroy( &p_condvar->cond );
if ( i_result )
......@@ -484,9 +490,6 @@ int __vlc_cond_destroy( char * psz_file, int i_line, vlc_cond_t *p_condvar )
#elif defined( HAVE_CTHREADS_H )
return 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_condvar->init = 0;
return 0;
#endif
if( i_result )
......@@ -549,6 +552,11 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
i_ret = ( p_this->thread_id ? 0 : 1 );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_this->thread_id = spawn_thread( (thread_func)func, psz_name,
i_priority, p_data );
i_ret = resume_thread( p_this->thread_id );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data );
......@@ -588,11 +596,6 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
p_this->thread_id = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
i_ret = 0;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_this->thread_id = spawn_thread( (thread_func)func, psz_name,
i_priority, p_data );
i_ret = resume_thread( p_this->thread_id );
#endif
if( i_ret == 0 )
......@@ -662,7 +665,7 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, char * psz_file,
if ( (i_error = pthread_setschedparam( pthread_self(),
i_policy, &param )) )
{
msg_Warn( p_this, "couldn't set thread priority (%s:%d): %s",
msg_Warn( p_this, "couldn't set thread priority (%s:%d): %s",
psz_file, i_line, strerror(i_error) );
i_priority = 0;
}
......@@ -703,6 +706,10 @@ void __vlc_thread_join( vlc_object_t *p_this, char * psz_file, int i_line )
#elif defined( WIN32 )
WaitForSingleObject( p_this->thread_id, INFINITE );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
int32_t exit_value;
wait_for_thread( p_this->thread_id, &exit_value );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_join( p_this->thread_id, NULL );
......@@ -710,10 +717,6 @@ void __vlc_thread_join( vlc_object_t *p_this, char * psz_file, int i_line )
cthread_join( p_this->thread_id );
i_ret = 1;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
int32_t exit_value;
wait_for_thread( p_this->thread_id, &exit_value );
#endif
if( i_ret )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment