* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: threads.h,v 1.21 2001/07/25 08:41:21 gbazin Exp $
+ * $Id: threads.h,v 1.22 2001/07/31 21:13:30 gbazin Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
/* Release one waiting thread if one is available. */
/* For this trick to work properly, the vlc_cond_signal must be surrounded
* by a mutex. This will prevent another thread from stealing the signal */
- while( p_condvar->i_waiting_threads )
+ int i_waiting_threads = p_condvar->i_waiting_threads;
+ while( p_condvar->i_waiting_threads
+ && p_condvar->i_waiting_threads == i_waiting_threads )
{
PulseEvent( p_condvar->signal );
- Sleep( 0 ); /* deschedule the current thread */
+ Sleep( 1 ); /* deschedule the current thread */
}
return 0;
while( p_condvar->i_waiting_threads )
{
PulseEvent( p_condvar->signal );
- Sleep( 0 ); /* deschedule the current thread */
+ Sleep( 1 ); /* deschedule the current thread */
}
return 0;
* input_ps.c: PS demux and packet management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ps.c,v 1.30 2001/07/17 09:48:07 massiot Exp $
+ * $Id: input_ps.c,v 1.31 2001/07/31 21:13:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
*****************************************************************************/
static void PSEnd( input_thread_t * p_input )
{
- vlc_mutex_destroy( &((packet_cache_t *)p_input->p_plugin_data)->lock );
+#define p_packet_cache ((packet_cache_t *)p_input->p_method_data)
+
+ vlc_mutex_destroy( &p_packet_cache->lock );
+
+ if( p_packet_cache->data.p_stack )
+ free( p_packet_cache->data.p_stack );
+ if( p_packet_cache->pes.p_stack )
+ free( p_packet_cache->pes.p_stack );
+ if( p_packet_cache->smallbuffer.p_stack )
+ free( p_packet_cache->smallbuffer.p_stack );
+ if( p_packet_cache->largebuffer.p_stack )
+ free( p_packet_cache->largebuffer.p_stack );
+
+#undef p_packet_cache
+
+ free( p_input->p_method_data );
free( p_input->p_plugin_data );
}
* video_decoder.c : video decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_decoder.c,v 1.55 2001/07/18 17:05:39 massiot Exp $
+ * $Id: video_decoder.c,v 1.56 2001/07/31 21:13:30 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Gaƫl Hendryckx <jimmy@via.ecp.fr>
{
intf_DbgMsg("vdec debug: initializing video decoder thread %p", p_vdec);
-#if !defined(SYS_BEOS) && !defined(WIN32)
+#if !defined(SYS_BEOS)
# if VDEC_NICE
/* Re-nice ourself - otherwise we would steal CPU time from the video
* output, which would make a poor display. */
+#if !defined(WIN32)
if( nice(VDEC_NICE) == -1 )
+#else
+ if( !SetThreadPriority( GetCurrentThread(),
+ THREAD_PRIORITY_BELOW_NORMAL ) )
+#endif
{
intf_WarnMsg( 2, "vpar warning : couldn't nice() (%s)",
strerror(errno) );