1 /*****************************************************************************
2 * vlc_threads_funcs.h : threads implementation for the VideoLAN client
3 * This header provides a portable threads implementation.
4 *****************************************************************************
5 * Copyright (C) 1999-2007 the VideoLAN team
8 * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
9 * Samuel Hocevar <sam@via.ecp.fr>
10 * Gildas Bazin <gbazin@netcourrier.com>
11 * Christophe Massiot <massiot@via.ecp.fr>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
28 #if !defined( __LIBVLC__ )
29 #error You are not libvlc or one of its plugins. You cannot include this file
32 #ifndef _VLC_THREADFUNCS_H_
33 #define _VLC_THREADFUNCS_H_
35 /*****************************************************************************
36 * Function definitions
37 *****************************************************************************/
38 VLC_EXPORT( void, __vlc_threads_error, ( vlc_object_t *) );
39 VLC_EXPORT( int, __vlc_mutex_init, ( vlc_object_t *, vlc_mutex_t * ) );
40 VLC_EXPORT( int, __vlc_mutex_destroy, ( const char *, int, vlc_mutex_t * ) );
41 VLC_EXPORT( int, __vlc_cond_init, ( vlc_object_t *, vlc_cond_t * ) );
42 VLC_EXPORT( int, __vlc_cond_destroy, ( const char *, int, vlc_cond_t * ) );
43 VLC_EXPORT( int, __vlc_threadvar_create, (vlc_object_t *, vlc_threadvar_t * ) );
44 VLC_EXPORT( int, __vlc_thread_create, ( vlc_object_t *, const char *, int, const char *, void * ( * ) ( void * ), int, vlc_bool_t ) );
45 VLC_EXPORT( int, __vlc_thread_set_priority, ( vlc_object_t *, const char *, int, int ) );
46 VLC_EXPORT( void, __vlc_thread_ready, ( vlc_object_t * ) );
47 VLC_EXPORT( void, __vlc_thread_join, ( vlc_object_t *, const char *, int ) );
49 /*****************************************************************************
50 * vlc_threads_error: Signalize an error in the threading system
51 *****************************************************************************/
52 #define vlc_threads_error( P_THIS ) \
53 __vlc_threads_error( VLC_OBJECT(P_THIS) )
55 /*****************************************************************************
56 * vlc_threads_init: initialize threads system
57 *****************************************************************************/
58 #define vlc_threads_init( P_THIS ) \
59 __vlc_threads_init( VLC_OBJECT(P_THIS) )
61 /*****************************************************************************
62 * vlc_threads_end: deinitialize threads system
63 *****************************************************************************/
64 #define vlc_threads_end( P_THIS ) \
65 __vlc_threads_end( VLC_OBJECT(P_THIS) )
67 /*****************************************************************************
68 * vlc_mutex_init: initialize a mutex
69 *****************************************************************************/
70 #define vlc_mutex_init( P_THIS, P_MUTEX ) \
71 __vlc_mutex_init( VLC_OBJECT(P_THIS), P_MUTEX )
73 /*****************************************************************************
74 * vlc_mutex_lock: lock a mutex
75 *****************************************************************************/
76 #define vlc_mutex_lock( P_MUTEX ) \
77 __vlc_mutex_lock( __FILE__, __LINE__, P_MUTEX )
79 #if defined( PTHREAD_COND_T_IN_PTHREAD_H )
80 static inline unsigned long int CAST_PTHREAD_TO_INT (pthread_t th)
82 union { pthread_t th; unsigned long int i; } v = { };
88 static inline int __vlc_mutex_lock( const char * psz_file, int i_line,
89 vlc_mutex_t * p_mutex )
92 /* In case of error : */
93 unsigned long int i_thread = 0;
95 #if defined( PTH_INIT_IN_PTH_H )
96 i_result = ( pth_mutex_acquire( &p_mutex->mutex, FALSE, NULL ) == FALSE );
98 #elif defined( ST_INIT_IN_ST_H )
99 i_result = st_mutex_lock( p_mutex->mutex );
101 #elif defined( UNDER_CE )
102 EnterCriticalSection( &p_mutex->csection );
105 #elif defined( WIN32 )
108 WaitForSingleObject( p_mutex->mutex, INFINITE );
112 EnterCriticalSection( &p_mutex->csection );
116 #elif defined( HAVE_KERNEL_SCHEDULER_H )
117 if( p_mutex == NULL )
119 i_result = B_BAD_VALUE;
121 else if( p_mutex->init < 2000 )
123 i_result = B_NO_INIT;
127 i_result = acquire_sem( p_mutex->lock );
130 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
131 # define vlc_assert_locked( m ) \
132 assert (pthread_mutex_lock (&((m)->mutex)) == EDEADLK)
134 i_result = pthread_mutex_lock( &p_mutex->mutex );
137 i_thread = CAST_PTHREAD_TO_INT(pthread_self());
141 #elif defined( HAVE_CTHREADS_H )
142 mutex_lock( p_mutex->mutex );
149 msg_Err( p_mutex->p_this,
150 "thread %li: mutex_lock failed at %s:%d (%d:%m)",
151 i_thread, psz_file, i_line, i_result );
152 vlc_threads_error( p_mutex->p_this );
157 #ifndef vlc_assert_locked
158 # define vlc_assert_locked( m ) (void)0
161 /*****************************************************************************
162 * vlc_mutex_unlock: unlock a mutex
163 *****************************************************************************/
164 #define vlc_mutex_unlock( P_MUTEX ) \
165 __vlc_mutex_unlock( __FILE__, __LINE__, P_MUTEX )
167 static inline int __vlc_mutex_unlock( const char * psz_file, int i_line,
168 vlc_mutex_t *p_mutex )
171 /* In case of error : */
172 unsigned long int i_thread = 0;
174 #if defined( PTH_INIT_IN_PTH_H )
175 i_result = ( pth_mutex_release( &p_mutex->mutex ) == FALSE );
177 #elif defined( ST_INIT_IN_ST_H )
178 i_result = st_mutex_unlock( p_mutex->mutex );
180 #elif defined( UNDER_CE )
181 LeaveCriticalSection( &p_mutex->csection );
184 #elif defined( WIN32 )
187 ReleaseMutex( p_mutex->mutex );
191 LeaveCriticalSection( &p_mutex->csection );
195 #elif defined( HAVE_KERNEL_SCHEDULER_H )
196 if( p_mutex == NULL )
198 i_result = B_BAD_VALUE;
200 else if( p_mutex->init < 2000 )
202 i_result = B_NO_INIT;
206 release_sem( p_mutex->lock );
210 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
211 i_result = pthread_mutex_unlock( &p_mutex->mutex );
214 i_thread = CAST_PTHREAD_TO_INT(pthread_self());
218 #elif defined( HAVE_CTHREADS_H )
219 mutex_unlock( p_mutex );
226 msg_Err( p_mutex->p_this,
227 "thread %li: mutex_unlock failed at %s:%d (%d:%m)",
228 i_thread, psz_file, i_line, i_result );
229 vlc_threads_error( p_mutex->p_this );
235 /*****************************************************************************
236 * vlc_mutex_destroy: destroy a mutex
237 *****************************************************************************/
238 #define vlc_mutex_destroy( P_MUTEX ) \
239 __vlc_mutex_destroy( __FILE__, __LINE__, P_MUTEX )
241 /*****************************************************************************
242 * vlc_cond_init: initialize a condition
243 *****************************************************************************/
244 #define vlc_cond_init( P_THIS, P_COND ) \
245 __vlc_cond_init( VLC_OBJECT(P_THIS), P_COND )
247 /*****************************************************************************
248 * vlc_cond_signal: start a thread on condition completion
249 *****************************************************************************/
250 #define vlc_cond_signal( P_COND ) \
251 __vlc_cond_signal( __FILE__, __LINE__, P_COND )
253 static inline int __vlc_cond_signal( const char * psz_file, int i_line,
254 vlc_cond_t *p_condvar )
257 /* In case of error : */
258 unsigned long int i_thread = 0;
260 #if defined( PTH_INIT_IN_PTH_H )
261 i_result = ( pth_cond_notify( &p_condvar->cond, FALSE ) == FALSE );
263 #elif defined( ST_INIT_IN_ST_H )
264 i_result = st_cond_signal( p_condvar->cond );
266 #elif defined( UNDER_CE )
267 PulseEvent( p_condvar->event );
270 #elif defined( WIN32 )
271 /* Release one waiting thread if one is available. */
272 /* For this trick to work properly, the vlc_cond_signal must be surrounded
273 * by a mutex. This will prevent another thread from stealing the signal */
274 if( !p_condvar->semaphore )
277 ** PulseEvent() only works if none of the waiting threads is suspended.
278 ** this is particularily problematic under a debug session.
279 ** as documented in http://support.microsoft.com/kb/q173260/
281 PulseEvent( p_condvar->event );
283 else if( p_condvar->i_win9x_cv == 1 )
285 /* Wait for the gate to be open */
286 WaitForSingleObject( p_condvar->event, INFINITE );
288 if( p_condvar->i_waiting_threads )
290 /* Using a semaphore exposes us to a race condition. It is
291 * possible for another thread to start waiting on the semaphore
292 * just after we signaled it and thus steal the signal.
293 * We have to prevent new threads from entering the cond_wait(). */
294 ResetEvent( p_condvar->event );
296 /* A semaphore is used here because Win9x doesn't have
297 * SignalObjectAndWait() and thus a race condition exists
298 * during the time we release the mutex and the time we start
299 * waiting on the event (more precisely, the signal can sometimes
300 * be missed by the waiting thread if we use PulseEvent()). */
301 ReleaseSemaphore( p_condvar->semaphore, 1, 0 );
306 if( p_condvar->i_waiting_threads )
308 ReleaseSemaphore( p_condvar->semaphore, 1, 0 );
310 /* Wait for the last thread to be awakened */
311 WaitForSingleObject( p_condvar->event, INFINITE );
316 #elif defined( HAVE_KERNEL_SCHEDULER_H )
317 if( p_condvar == NULL )
319 i_result = B_BAD_VALUE;
321 else if( p_condvar->init < 2000 )
323 i_result = B_NO_INIT;
327 while( p_condvar->thread != -1 )
330 if( get_thread_info(p_condvar->thread, &info) == B_BAD_VALUE )
335 if( info.state != B_THREAD_SUSPENDED )
337 /* The waiting thread is not suspended so it could
338 * have been interrupted beetwen the unlock and the
339 * suspend_thread line. That is why we sleep a little
340 * before retesting p_condver->thread. */
345 /* Ok, we have to wake up that thread */
346 resume_thread( p_condvar->thread );
353 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
354 i_result = pthread_cond_signal( &p_condvar->cond );
357 i_thread = CAST_PTHREAD_TO_INT(pthread_self());
361 #elif defined( HAVE_CTHREADS_H )
362 /* condition_signal() */
363 if ( p_condvar->queue.head || p_condvar->implications )
365 cond_signal( (condition_t)p_condvar );
373 msg_Err( p_condvar->p_this,
374 "thread %li: cond_signal failed at %s:%d (%d:%m)",
375 i_thread, psz_file, i_line, i_result );
376 vlc_threads_error( p_condvar->p_this );
382 /*****************************************************************************
383 * vlc_cond_wait: wait until condition completion
384 *****************************************************************************/
385 #define vlc_cond_wait( P_COND, P_MUTEX ) \
386 __vlc_cond_wait( __FILE__, __LINE__, P_COND, P_MUTEX )
388 static inline int __vlc_cond_wait( const char * psz_file, int i_line,
389 vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex )
392 /* In case of error : */
393 unsigned long int i_thread = 0;
395 #if defined( PTH_INIT_IN_PTH_H )
396 i_result = ( pth_cond_await( &p_condvar->cond, &p_mutex->mutex, NULL )
399 #elif defined( ST_INIT_IN_ST_H )
400 st_mutex_unlock( p_mutex->mutex );
401 i_result = st_cond_wait( p_condvar->cond );
402 st_mutex_lock( p_mutex->mutex );
404 #elif defined( UNDER_CE )
405 p_condvar->i_waiting_threads++;
406 LeaveCriticalSection( &p_mutex->csection );
407 WaitForSingleObject( p_condvar->event, INFINITE );
408 p_condvar->i_waiting_threads--;
410 /* Reacquire the mutex before returning. */
411 vlc_mutex_lock( p_mutex );
415 #elif defined( WIN32 )
416 if( !p_condvar->semaphore )
418 /* Increase our wait count */
419 p_condvar->i_waiting_threads++;
423 /* It is only possible to atomically release the mutex and
424 * initiate the waiting on WinNT/2K/XP. Win9x doesn't have
425 * SignalObjectAndWait(). */
426 p_condvar->SignalObjectAndWait( p_mutex->mutex,
432 LeaveCriticalSection( &p_mutex->csection );
433 WaitForSingleObject( p_condvar->event, INFINITE );
436 p_condvar->i_waiting_threads--;
438 else if( p_condvar->i_win9x_cv == 1 )
440 int i_waiting_threads;
442 /* Wait for the gate to be open */
443 WaitForSingleObject( p_condvar->event, INFINITE );
445 /* Increase our wait count */
446 p_condvar->i_waiting_threads++;
448 LeaveCriticalSection( &p_mutex->csection );
449 WaitForSingleObject( p_condvar->semaphore, INFINITE );
451 /* Decrement and test must be atomic */
452 EnterCriticalSection( &p_condvar->csection );
454 /* Decrease our wait count */
455 i_waiting_threads = --p_condvar->i_waiting_threads;
457 LeaveCriticalSection( &p_condvar->csection );
459 /* Reopen the gate if we were the last waiting thread */
460 if( !i_waiting_threads )
461 SetEvent( p_condvar->event );
465 int i_waiting_threads;
467 /* Increase our wait count */
468 p_condvar->i_waiting_threads++;
470 LeaveCriticalSection( &p_mutex->csection );
471 WaitForSingleObject( p_condvar->semaphore, INFINITE );
473 /* Decrement and test must be atomic */
474 EnterCriticalSection( &p_condvar->csection );
476 /* Decrease our wait count */
477 i_waiting_threads = --p_condvar->i_waiting_threads;
479 LeaveCriticalSection( &p_condvar->csection );
481 /* Signal that the last waiting thread just went through */
482 if( !i_waiting_threads )
483 SetEvent( p_condvar->event );
486 /* Reacquire the mutex before returning. */
487 vlc_mutex_lock( p_mutex );
491 #elif defined( HAVE_KERNEL_SCHEDULER_H )
492 if( p_condvar == NULL )
494 i_result = B_BAD_VALUE;
496 else if( p_mutex == NULL )
498 i_result = B_BAD_VALUE;
500 else if( p_condvar->init < 2000 )
502 i_result = B_NO_INIT;
505 /* The p_condvar->thread var is initialized before the unlock because
506 * it enables to identify when the thread is interrupted beetwen the
507 * unlock line and the suspend_thread line */
508 p_condvar->thread = find_thread( NULL );
509 vlc_mutex_unlock( p_mutex );
510 suspend_thread( p_condvar->thread );
511 p_condvar->thread = -1;
513 vlc_mutex_lock( p_mutex );
516 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
519 /* In debug mode, timeout */
520 struct timespec timeout = {
521 (mdate() / 1000000) + THREAD_COND_TIMEOUT,
522 0 /* 1Hz precision is sufficient here :-) */
525 i_result = pthread_cond_timedwait( &p_condvar->cond, &p_mutex->mutex,
528 if( i_result == ETIMEDOUT )
531 msg_Dbg( p_condvar->p_this,
532 "thread %li: possible condition deadlock "
533 "at %s:%d (%m)", CAST_PTHREAD_TO_INT(pthread_self()),
536 i_result = pthread_cond_wait( &p_condvar->cond, &p_mutex->mutex );
540 i_result = pthread_cond_wait( &p_condvar->cond, &p_mutex->mutex );
545 i_thread = CAST_PTHREAD_TO_INT(pthread_self());
549 #elif defined( HAVE_CTHREADS_H )
550 condition_wait( (condition_t)p_condvar, (mutex_t)p_mutex );
557 msg_Err( p_condvar->p_this,
558 "thread %li: cond_wait failed at %s:%d (%d:%m)",
559 i_thread, psz_file, i_line, i_result );
560 vlc_threads_error( p_condvar->p_this );
567 /*****************************************************************************
568 * vlc_cond_timedwait: wait until condition completion or expiration
569 *****************************************************************************
570 * Returns 0 if object signaled, an error code in case of timeout or error.
571 *****************************************************************************/
572 #define vlc_cond_timedwait( P_COND, P_MUTEX, DEADLINE ) \
573 __vlc_cond_timedwait( __FILE__, __LINE__, P_COND, P_MUTEX, DEADLINE )
575 static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
576 vlc_cond_t *p_condvar,
577 vlc_mutex_t *p_mutex,
581 unsigned long int i_thread = 0;
583 #if defined( PTH_INIT_IN_PTH_H )
584 # error Unimplemented
585 #elif defined( ST_INIT_IN_ST_H )
586 # error Unimplemented
587 #elif defined( UNDER_CE )
588 mtime_t delay_ms = (deadline - mdate())/1000;
594 p_condvar->i_waiting_threads++;
595 LeaveCriticalSection( &p_mutex->csection );
596 result = WaitForSingleObject( p_condvar->event, delay_ms );
597 p_condvar->i_waiting_threads--;
599 /* Reacquire the mutex before returning. */
600 vlc_mutex_lock( p_mutex );
604 #elif defined( WIN32 )
607 mtime_t delay_ms = (deadline - mdate())/1000;
611 if( !p_condvar->semaphore )
613 /* Increase our wait count */
614 p_condvar->i_waiting_threads++;
618 /* It is only possible to atomically release the mutex and
619 * initiate the waiting on WinNT/2K/XP. Win9x doesn't have
620 * SignalObjectAndWait(). */
621 result = p_condvar->SignalObjectAndWait( p_mutex->mutex,
627 LeaveCriticalSection( &p_mutex->csection );
628 result = WaitForSingleObject( p_condvar->event, delay_ms );
631 p_condvar->i_waiting_threads--;
633 else if( p_condvar->i_win9x_cv == 1 )
635 int i_waiting_threads;
637 /* Wait for the gate to be open */
638 result = WaitForSingleObject( p_condvar->event, delay_ms );
640 /* Increase our wait count */
641 p_condvar->i_waiting_threads++;
643 LeaveCriticalSection( &p_mutex->csection );
646 /* recaculate remaining delay */
647 delay_ms = (deadline - mdate())/1000;
651 result = WaitForSingleObject( p_condvar->semaphore, delay_ms );
654 /* Decrement and test must be atomic */
655 EnterCriticalSection( &p_condvar->csection );
657 /* Decrease our wait count */
658 i_waiting_threads = --p_condvar->i_waiting_threads;
660 LeaveCriticalSection( &p_condvar->csection );
662 /* Reopen the gate if we were the last waiting thread */
663 if( !i_waiting_threads )
664 SetEvent( p_condvar->event );
668 int i_waiting_threads;
670 /* Increase our wait count */
671 p_condvar->i_waiting_threads++;
673 LeaveCriticalSection( &p_mutex->csection );
674 result = WaitForSingleObject( p_condvar->semaphore, delay_ms );
676 /* Decrement and test must be atomic */
677 EnterCriticalSection( &p_condvar->csection );
679 /* Decrease our wait count */
680 i_waiting_threads = --p_condvar->i_waiting_threads;
682 LeaveCriticalSection( &p_condvar->csection );
684 /* Signal that the last waiting thread just went through */
685 if( !i_waiting_threads )
686 SetEvent( p_condvar->event );
689 /* Reacquire the mutex before returning. */
690 vlc_mutex_lock( p_mutex );
694 #elif defined( HAVE_KERNEL_SCHEDULER_H )
695 # error Unimplemented
696 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
697 lldiv_t d = lldiv( deadline, 1000000 );
698 struct timespec ts = { d.quot, d.rem * 1000 };
700 i_res = pthread_cond_timedwait( &p_condvar->cond, &p_mutex->mutex, &ts );
701 if( i_res == ETIMEDOUT )
702 return ETIMEDOUT; /* this error is perfectly normal */
704 if ( i_res ) /* other errors = bug */
706 i_thread = CAST_PTHREAD_TO_INT(pthread_self());
710 #elif defined( HAVE_CTHREADS_H )
711 # error Unimplemented
716 msg_Err( p_condvar->p_this,
717 "thread %li: cond_wait failed at %s:%d (%d:%m)",
718 i_thread, psz_file, i_line, i_res );
719 vlc_threads_error( p_condvar->p_this );
725 /*****************************************************************************
726 * vlc_cond_destroy: destroy a condition
727 *****************************************************************************/
728 #define vlc_cond_destroy( P_COND ) \
729 __vlc_cond_destroy( __FILE__, __LINE__, P_COND )
731 /*****************************************************************************
732 * vlc_threadvar_create: create a thread-local variable
733 *****************************************************************************/
734 #define vlc_threadvar_create( PTHIS, P_TLS ) \
735 __vlc_threadvar_create( PTHIS, P_TLS )
737 /*****************************************************************************
738 * vlc_threadvar_set: create: set the value of a thread-local variable
739 *****************************************************************************/
740 static inline int vlc_threadvar_set( vlc_threadvar_t * p_tls, void *p_value )
744 #if defined( PTH_INIT_IN_PTH_H )
745 return pth_key_setdata( p_tls->handle, p_value );
746 #elif defined( ST_INIT_IN_ST_H )
747 return st_thread_setspecific( p_tls->handle, p_value );
748 #elif defined( HAVE_KERNEL_SCHEDULER_H )
751 #elif defined( UNDER_CE ) || defined( WIN32 )
752 i_ret = ( TlsSetValue( p_tls->handle, p_value ) != 0 );
754 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
755 i_ret = pthread_setspecific( p_tls->handle, p_value );
757 #elif defined( HAVE_CTHREADS_H )
758 i_ret = cthread_setspecific( p_tls->handle, p_value );
764 /*****************************************************************************
765 * vlc_threadvar_get: create: get the value of a thread-local variable
766 *****************************************************************************/
767 static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
771 #if defined( PTH_INIT_IN_PTH_H )
772 p_ret = pth_key_getdata( p_handle->key );
773 #elif defined( ST_INIT_IN_ST_H )
774 p_ret = st_thread_getspecific( p_handle->key );
775 #elif defined( HAVE_KERNEL_SCHEDULER_H )
777 #elif defined( UNDER_CE ) || defined( WIN32 )
778 p_ret = TlsGetValue( p_tls->handle );
780 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
781 p_ret = pthread_getspecific( p_tls->handle );
783 #elif defined( HAVE_CTHREADS_H )
784 if ( !cthread_getspecific( p_tls->handle, &p_ret ) )
793 /*****************************************************************************
794 * vlc_thread_create: create a thread
795 *****************************************************************************/
796 #define vlc_thread_create( P_THIS, PSZ_NAME, FUNC, PRIORITY, WAIT ) \
797 __vlc_thread_create( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PSZ_NAME, (void * ( * ) ( void * ))FUNC, PRIORITY, WAIT )
799 /*****************************************************************************
800 * vlc_thread_set_priority: set the priority of the calling thread
801 *****************************************************************************/
802 #define vlc_thread_set_priority( P_THIS, PRIORITY ) \
803 __vlc_thread_set_priority( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PRIORITY )
805 /*****************************************************************************
806 * vlc_thread_ready: tell the parent thread we were successfully spawned
807 *****************************************************************************/
808 #define vlc_thread_ready( P_THIS ) \
809 __vlc_thread_ready( VLC_OBJECT(P_THIS) )
811 /*****************************************************************************
812 * vlc_thread_join: wait until a thread exits
813 *****************************************************************************/
814 #define vlc_thread_join( P_THIS ) \
815 __vlc_thread_join( VLC_OBJECT(P_THIS), __FILE__, __LINE__ )