* 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>
* 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
#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
#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 !
# 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
# 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
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
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
* 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>
}
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 )
{
{
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 )
}
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 )
{
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 )
}
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 )
{
}
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 )
}
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 )
{
}
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 )
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
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 )
* 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>
*
#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") };
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;
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 -
{
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 ];
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;
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 -
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 ];
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;
}
#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 )
*(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;
}
#endif
#endif
-
+
/* Calculate relative glyph positions and a bounding box for the
* entire string */
p_line = NewLine( psz_string );
free( p_line->p_glyph_pos );
free( p_line );
}
-
+
free( p_string->psz_text );
free( p_string );
}
* 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>
#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_( \
#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 " \
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 );
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 );
#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,
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,
/* 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 );
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
* 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>
#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
/*****************************************************************************
#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 )
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 );
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 )
#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--;
#elif defined( HAVE_CTHREADS_H )
i_initializations--;
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
- i_initializations--;
-
#endif
return VLC_SUCCESS;
}
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 )
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
}
}
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 )
#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 )
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 )
{
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
}
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 )
#elif defined( HAVE_CTHREADS_H )
return 0;
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
- p_condvar->init = 0;
- return 0;
#endif
if( i_result )
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 );
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 )
if ( (i_error = pthread_setschedparam( pthread_self(),
i_policy, ¶m )) )
{
- 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;
}
#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 );
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 )