* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: threads.c,v 1.29 2002/12/14 19:19:08 gbazin Exp $
+ * $Id: threads.c,v 1.34 2003/01/10 17:01:53 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
if ( i_priority )
{
+ int i_error;
struct sched_param param;
memset( ¶m, 0, sizeof(struct sched_param) );
param.sched_priority = i_priority;
- if ( pthread_setschedparam( p_this->thread_id, SCHED_RR, ¶m ) )
+ if ( (i_error = pthread_setschedparam( p_this->thread_id,
+ SCHED_RR, ¶m )) )
{
- msg_Warn( p_this, "couldn't go to real-time priority (%s:%d)",
- psz_file, i_line );
+ msg_Warn( p_this, "couldn't go to real-time priority (%s:%d): %s",
+ psz_file, i_line, strerror(i_error) );
i_priority = 0;
}
+
}
#elif defined( HAVE_CTHREADS_H )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_this->thread_id = spawn_thread( (thread_func)func, psz_name,
- B_NORMAL_PRIORITY, (void *)p_this );
+ i_priority/* B_NORMAL_PRIORITY */, (void *)p_this );
i_ret = resume_thread( p_this->thread_id );
#endif
p_this->b_thread = 1;
msg_Dbg( p_this, "thread %d (%s) created at priority %d (%s:%d)",
- p_this->thread_id, psz_name, i_priority,
+ (int)p_this->thread_id, psz_name, i_priority,
psz_file, i_line );
vlc_mutex_unlock( &p_this->object_lock );
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
if ( i_priority )
{
+ int i_error;
struct sched_param param;
memset( ¶m, 0, sizeof(struct sched_param) );
param.sched_priority = i_priority;
- if ( pthread_setschedparam( pthread_self(), SCHED_RR, ¶m ) )
+ if ( (i_error = pthread_setschedparam( pthread_self(),
+ SCHED_RR, ¶m )) )
{
- msg_Warn( p_this, "couldn't go to real-time priority (%s:%d)",
- psz_file, i_line );
- return 1;
+ msg_Warn( p_this, "couldn't go to real-time priority (%s:%d): %s",
+ psz_file, i_line, strerror(i_error) );
+ i_priority = 0;
}
}
-#else
- return 1;
#endif
return 0;
{
#ifdef HAVE_STRERROR
msg_Err( p_this, "thread_join(%d) failed at %s:%d (%s)",
- p_this->thread_id, psz_file, i_line, strerror(i_ret) );
+ (int)p_this->thread_id, psz_file, i_line,
+ strerror(i_ret) );
#else
msg_Err( p_this, "thread_join(%d) failed at %s:%d",
- p_this->thread_id, psz_file, i_line );
+ (int)p_this->thread_id, psz_file, i_line );
#endif
}
else
{
msg_Dbg( p_this, "thread %d joined (%s:%d)",
- p_this->thread_id, psz_file, i_line );
+ (int)p_this->thread_id, psz_file, i_line );
}
p_this->b_thread = 0;