* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN
- * $Id: vlc_threads_funcs.h,v 1.7 2002/10/27 17:23:17 titer Exp $
+ * $Id: vlc_threads_funcs.h,v 1.9 2002/11/11 14:39:11 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
#elif defined( ST_INIT_IN_ST_H )
i_result = st_mutex_lock( p_mutex->mutex );
+#elif defined( UNDER_CE )
+ EnterCriticalSection( &p_mutex->csection );
+ return 0;
+
#elif defined( WIN32 )
if( p_mutex->mutex )
{
#elif defined( ST_INIT_IN_ST_H )
i_result = st_mutex_unlock( p_mutex->mutex );
+#elif defined( UNDER_CE )
+ LeaveCriticalSection( &p_mutex->csection );
+ return 0;
+
#elif defined( WIN32 )
if( p_mutex->mutex )
{
#elif defined( ST_INIT_IN_ST_H )
i_result = st_cond_signal( p_condvar->cond );
+#elif defined( UNDER_CE )
+ PulseEvent( p_condvar->event );
+ return 0;
+
#elif defined( WIN32 )
/* Release one waiting thread if one is available. */
/* For this trick to work properly, the vlc_cond_signal must be surrounded
#elif defined( ST_INIT_IN_ST_H )
i_result = st_cond_broadcast( p_condvar->cond );
+#elif defined( UNDER_CE )
+ int i;
+
+ /* Release all waiting threads. */
+ for( i = p_condvar->i_waiting_threads; i > 0; i-- )
+ {
+ PulseEvent( p_condvar->event );
+ }
+ return 0;
+
#elif defined( WIN32 )
int i;
i_result = st_cond_wait( p_condvar->cond );
st_mutex_lock( p_mutex->mutex );
+#elif defined( UNDER_CE )
+ p_condvar->i_waiting_threads++;
+ LeaveCriticalSection( &p_mutex->csection );
+ WaitForSingleObject( p_condvar->event, INFINITE );
+ p_condvar->i_waiting_threads--;
+
+ /* Reacquire the mutex before returning. */
+ vlc_mutex_lock( p_mutex );
+
+ return 0;
+
#elif defined( WIN32 )
if( !p_condvar->semaphore )
{