]> git.sesse.net Git - vlc/blob - include/vlc_threads.h
vlc_cond_init: really remove useless parameter
[vlc] / include / vlc_threads.h
1 /*****************************************************************************
2  * vlc_threads.h : threads implementation for the VideoLAN client
3  * This header provides portable declarations for mutexes & conditions
4  *****************************************************************************
5  * Copyright (C) 1999, 2002 the VideoLAN team
6  * Copyright © 2007-2008 Rémi Denis-Courmont
7  *
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>
12  *
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.
17  *
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.
22  *
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  *****************************************************************************/
27
28 #ifndef VLC_THREADS_H_
29 #define VLC_THREADS_H_
30
31 /**
32  * \file
33  * This file defines structures and functions for handling threads in vlc
34  *
35  */
36
37 #if defined( UNDER_CE )
38                                                                 /* WinCE API */
39 #elif defined( WIN32 )
40 #   include <process.h>                                         /* Win32 API */
41 #   include <errno.h>
42
43 #else                                         /* pthreads (like Linux & BSD) */
44 #   define LIBVLC_USE_PTHREAD 1
45 #   define LIBVLC_USE_PTHREAD_CANCEL 1
46 #   define _APPLE_C_SOURCE    1 /* Proper pthread semantics on OSX */
47
48 #   include <stdlib.h> /* lldiv_t definition (only in C99) */
49 #   include <unistd.h> /* _POSIX_SPIN_LOCKS */
50 #   include <pthread.h>
51     /* Needed for pthread_cond_timedwait */
52 #   include <errno.h>
53 #   include <time.h>
54
55 #endif
56
57 /*****************************************************************************
58  * Constants
59  *****************************************************************************/
60
61 /* Thread priorities */
62 #ifdef __APPLE__
63 #   define VLC_THREAD_PRIORITY_LOW      0
64 #   define VLC_THREAD_PRIORITY_INPUT   22
65 #   define VLC_THREAD_PRIORITY_AUDIO   22
66 #   define VLC_THREAD_PRIORITY_VIDEO    0
67 #   define VLC_THREAD_PRIORITY_OUTPUT  22
68 #   define VLC_THREAD_PRIORITY_HIGHEST 22
69
70 #elif defined(LIBVLC_USE_PTHREAD)
71 #   define VLC_THREAD_PRIORITY_LOW      0
72 #   define VLC_THREAD_PRIORITY_INPUT   10
73 #   define VLC_THREAD_PRIORITY_AUDIO    5
74 #   define VLC_THREAD_PRIORITY_VIDEO    0
75 #   define VLC_THREAD_PRIORITY_OUTPUT  15
76 #   define VLC_THREAD_PRIORITY_HIGHEST 20
77
78 #elif defined(WIN32) || defined(UNDER_CE)
79 /* Define different priorities for WinNT/2K/XP and Win9x/Me */
80 #   define VLC_THREAD_PRIORITY_LOW 0
81 #   define VLC_THREAD_PRIORITY_INPUT \
82         (IS_WINNT ? THREAD_PRIORITY_ABOVE_NORMAL : 0)
83 #   define VLC_THREAD_PRIORITY_AUDIO \
84         (IS_WINNT ? THREAD_PRIORITY_HIGHEST : 0)
85 #   define VLC_THREAD_PRIORITY_VIDEO \
86         (IS_WINNT ? 0 : THREAD_PRIORITY_BELOW_NORMAL )
87 #   define VLC_THREAD_PRIORITY_OUTPUT \
88         (IS_WINNT ? THREAD_PRIORITY_ABOVE_NORMAL : 0)
89 #   define VLC_THREAD_PRIORITY_HIGHEST \
90         (IS_WINNT ? THREAD_PRIORITY_TIME_CRITICAL : 0)
91
92 #else
93 #   define VLC_THREAD_PRIORITY_LOW 0
94 #   define VLC_THREAD_PRIORITY_INPUT 0
95 #   define VLC_THREAD_PRIORITY_AUDIO 0
96 #   define VLC_THREAD_PRIORITY_VIDEO 0
97 #   define VLC_THREAD_PRIORITY_OUTPUT 0
98 #   define VLC_THREAD_PRIORITY_HIGHEST 0
99
100 #endif
101
102 /*****************************************************************************
103  * Type definitions
104  *****************************************************************************/
105
106 #if defined (LIBVLC_USE_PTHREAD)
107 typedef pthread_t       vlc_thread_t;
108 typedef pthread_mutex_t vlc_mutex_t;
109 typedef pthread_cond_t  vlc_cond_t;
110 typedef pthread_key_t   vlc_threadvar_t;
111
112 #elif defined( WIN32 ) || defined( UNDER_CE )
113 typedef struct
114 {
115     HANDLE handle;
116     void  *(*entry) (void *);
117     void  *data;
118 } *vlc_thread_t;
119
120 typedef HANDLE  vlc_mutex_t;
121 typedef HANDLE  vlc_cond_t;
122 typedef DWORD   vlc_threadvar_t;
123
124 #endif
125
126 #if defined( WIN32 ) && !defined ETIMEDOUT
127 #  define ETIMEDOUT 10060 /* This is the value in winsock.h. */
128 #endif
129
130 /*****************************************************************************
131  * Function definitions
132  *****************************************************************************/
133 VLC_EXPORT( int,  vlc_mutex_init,    ( vlc_mutex_t * ) );
134 VLC_EXPORT( int,  vlc_mutex_init_recursive, ( vlc_mutex_t * ) );
135 VLC_EXPORT( void,  __vlc_mutex_destroy, ( const char *, int, vlc_mutex_t * ) );
136 VLC_EXPORT( int,  vlc_cond_init,     ( vlc_cond_t * ) );
137 VLC_EXPORT( void,  __vlc_cond_destroy,  ( const char *, int, vlc_cond_t * ) );
138 VLC_EXPORT( int, vlc_threadvar_create, (vlc_threadvar_t * , void (*) (void *) ) );
139 VLC_EXPORT( void, vlc_threadvar_delete, (vlc_threadvar_t *) );
140 VLC_EXPORT( int,  __vlc_thread_create, ( vlc_object_t *, const char *, int, const char *, void * ( * ) ( vlc_object_t * ), int, bool ) );
141 VLC_EXPORT( int,  __vlc_thread_set_priority, ( vlc_object_t *, const char *, int, int ) );
142 VLC_EXPORT( void, __vlc_thread_join,   ( vlc_object_t * ) );
143
144 VLC_EXPORT( int, vlc_clone, (vlc_thread_t *, void * (*) (void *), void *, int) );
145 VLC_EXPORT( void, vlc_cancel, (vlc_thread_t) );
146 VLC_EXPORT( void, vlc_join, (vlc_thread_t, void **) );
147 VLC_EXPORT (void, vlc_control_cancel, (int cmd, ...));
148
149 #ifndef LIBVLC_USE_PTHREAD_CANCEL
150 enum {
151     VLC_SAVE_CANCEL,
152     VLC_RESTORE_CANCEL,
153     VLC_TEST_CANCEL,
154     VLC_DO_CANCEL,
155     VLC_CLEANUP_PUSH,
156     VLC_CLEANUP_POP,
157 };
158 #endif
159
160 #define vlc_thread_ready vlc_object_signal
161
162 /*****************************************************************************
163  * vlc_mutex_lock: lock a mutex
164  *****************************************************************************/
165 #define vlc_mutex_lock( P_MUTEX )                                           \
166     __vlc_mutex_lock( __FILE__, __LINE__, P_MUTEX )
167
168 VLC_EXPORT(void, vlc_thread_fatal, (const char *action, int error, const char *function, const char *file, unsigned line));
169
170 #if defined(LIBVLC_USE_PTHREAD)
171 # define VLC_THREAD_ASSERT( action ) \
172     if (val) \
173         vlc_thread_fatal (action, val, __func__, psz_file, i_line)
174 #else
175 # define VLC_THREAD_ASSERT ((void)(val))
176 #endif
177
178 static inline void __vlc_mutex_lock( const char * psz_file, int i_line,
179                                     vlc_mutex_t * p_mutex )
180 {
181 #if defined(LIBVLC_USE_PTHREAD)
182 #   define vlc_assert_locked( m ) \
183            assert (pthread_mutex_lock (m) == EDEADLK)
184     int val = pthread_mutex_lock( p_mutex );
185     VLC_THREAD_ASSERT ("locking mutex");
186
187 #elif defined( UNDER_CE )
188     (void)psz_file; (void)i_line;
189
190     EnterCriticalSection( &p_mutex->csection );
191
192 #elif defined( WIN32 )
193     (void)psz_file; (void)i_line;
194
195     WaitForSingleObject( *p_mutex, INFINITE );
196
197 #endif
198 }
199
200 #ifndef vlc_assert_locked
201 # define vlc_assert_locked( m ) (void)m
202 #endif
203
204 /*****************************************************************************
205  * vlc_mutex_unlock: unlock a mutex
206  *****************************************************************************/
207 #define vlc_mutex_unlock( P_MUTEX )                                         \
208     __vlc_mutex_unlock( __FILE__, __LINE__, P_MUTEX )
209
210 static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
211                                       vlc_mutex_t *p_mutex )
212 {
213 #if defined(LIBVLC_USE_PTHREAD)
214     int val = pthread_mutex_unlock( p_mutex );
215     VLC_THREAD_ASSERT ("unlocking mutex");
216
217 #elif defined( UNDER_CE )
218     (void)psz_file; (void)i_line;
219
220     LeaveCriticalSection( &p_mutex->csection );
221
222 #elif defined( WIN32 )
223     (void)psz_file; (void)i_line;
224
225     ReleaseMutex( *p_mutex );
226
227 #endif
228 }
229
230 /*****************************************************************************
231  * vlc_mutex_destroy: destroy a mutex
232  *****************************************************************************/
233 #define vlc_mutex_destroy( P_MUTEX )                                        \
234     __vlc_mutex_destroy( __FILE__, __LINE__, P_MUTEX )
235
236 /**
237  * Save the cancellation state and disable cancellation for the calling thread.
238  * This function must be called before entering a piece of code that is not
239  * cancellation-safe.
240  * @return Previous cancellation state (opaque value).
241  */
242 static inline int vlc_savecancel (void)
243 {
244     int state;
245 #if defined (LIBVLC_USE_PTHREAD_CANCEL)
246     (void) pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
247 #else
248     vlc_control_cancel (VLC_SAVE_CANCEL, &state);
249 #endif
250     return state;
251 }
252
253 /**
254  * Restore the cancellation state for the calling thread.
255  * @param state previous state as returned by vlc_savecancel().
256  * @return Nothing, always succeeds.
257  */
258 static inline void vlc_restorecancel (int state)
259 {
260 #if defined (LIBVLC_USE_PTHREAD_CANCEL)
261     (void) pthread_setcancelstate (state, NULL);
262 #else
263     vlc_control_cancel (VLC_RESTORE_CANCEL, state);
264 #endif
265 }
266
267 /**
268  * Issues an explicit deferred cancellation point.
269  * This has no effect if thread cancellation is disabled.
270  * This can be called when there is a rather slow non-sleeping operation.
271  */
272 static inline void vlc_testcancel (void)
273 {
274 #if defined (LIBVLC_USE_PTHREAD_CANCEL)
275     pthread_testcancel ();
276 #else
277     vlc_control_cancel (VLC_TEST_CANCEL);
278 #endif
279 }
280
281 #if defined (LIBVLC_USE_PTHREAD_CANCEL)
282 /**
283  * Registers a new procedure to run if the thread is cancelled (or otherwise
284  * exits prematurely). Any call to vlc_cleanup_push() <b>must</b> paired with a
285  * call to either vlc_cleanup_pop() or vlc_cleanup_run(). Branching into or out
286  * of the block between these two function calls is not allowed (read: it will
287  * likely crash the whole process). If multiple procedures are registered,
288  * they are handled in last-in first-out order.
289  *
290  * @param routine procedure to call if the thread ends
291  * @param arg argument for the procedure
292  */
293 # define vlc_cleanup_push( routine, arg ) pthread_cleanup_push (routine, arg)
294
295 /**
296  * Removes a cleanup procedure that was previously registered with
297  * vlc_cleanup_push().
298  */
299 # define vlc_cleanup_pop( ) pthread_cleanup_pop (0)
300
301 /**
302  * Removes a cleanup procedure that was previously registered with
303  * vlc_cleanup_push(), and executes it.
304  */
305 # define vlc_cleanup_run( ) pthread_cleanup_pop (1)
306 #else
307 typedef struct vlc_cleanup_t vlc_cleanup_t;
308
309 struct vlc_cleanup_t
310 {
311     vlc_cleanup_t *next;
312     void         (*proc) (void *);
313     void          *data;
314 };
315
316 /* This macros opens a code block on purpose. This is needed for multiple
317  * calls within a single function. This also prevent Win32 developpers from
318  * writing code that would break on POSIX (POSIX opens a block as well). */
319 # define vlc_cleanup_push( routine, arg ) \
320     do { \
321         vlc_cleanup_t vlc_cleanup_data = { NULL, routine, arg, }; \
322         vlc_control_cancel (VLC_CLEANUP_PUSH, &vlc_cleanup_data)
323
324 # define vlc_cleanup_pop( ) \
325         vlc_control_cancel (VLC_CLEANUP_POP); \
326     } while (0)
327
328 # define vlc_cleanup_run( ) \
329         vlc_control_cancel (VLC_CLEANUP_POP); \
330         vlc_cleanup_data.proc (vlc_cleanup_data.data); \
331     } while (0)
332
333 #endif /* LIBVLC_USE_PTHREAD_CANCEL */
334
335 static inline void vlc_cleanup_lock (void *lock)
336 {
337     vlc_mutex_unlock ((vlc_mutex_t *)lock);
338 }
339 #define mutex_cleanup_push( lock ) vlc_cleanup_push (vlc_cleanup_lock, lock)
340
341 /*****************************************************************************
342  * vlc_cond_signal: start a thread on condition completion
343  *****************************************************************************/
344 #define vlc_cond_signal( P_COND )                                           \
345     __vlc_cond_signal( __FILE__, __LINE__, P_COND )
346
347 static inline void __vlc_cond_signal( const char * psz_file, int i_line,
348                                       vlc_cond_t *p_condvar )
349 {
350 #if defined(LIBVLC_USE_PTHREAD)
351     int val = pthread_cond_signal( p_condvar );
352     VLC_THREAD_ASSERT ("signaling condition variable");
353
354 #elif defined( UNDER_CE ) || defined( WIN32 )
355     (void)psz_file; (void)i_line;
356
357     /* Release one waiting thread if one is available. */
358     /* For this trick to work properly, the vlc_cond_signal must be surrounded
359      * by a mutex. This will prevent another thread from stealing the signal */
360     /* PulseEvent() only works if none of the waiting threads is suspended.
361      * This is particularily problematic under a debug session.
362      * as documented in http://support.microsoft.com/kb/q173260/ */
363     PulseEvent( *p_condvar );
364
365 #endif
366 }
367
368 /*****************************************************************************
369  * vlc_cond_wait: wait until condition completion
370  *****************************************************************************/
371 #define vlc_cond_wait( P_COND, P_MUTEX )                                     \
372     __vlc_cond_wait( __FILE__, __LINE__, P_COND, P_MUTEX  )
373
374 static inline void __vlc_cond_wait( const char * psz_file, int i_line,
375                                     vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex )
376 {
377 #if defined(LIBVLC_USE_PTHREAD)
378     int val = pthread_cond_wait( p_condvar, p_mutex );
379     VLC_THREAD_ASSERT ("waiting on condition");
380
381 #elif defined( UNDER_CE )
382     LeaveCriticalSection( &p_mutex->csection );
383     WaitForSingleObject( *p_condvar, INFINITE );
384
385     /* Reacquire the mutex before returning. */
386     vlc_mutex_lock( p_mutex );
387
388 #elif defined( WIN32 )
389     DWORD result;
390
391     do
392     {
393         vlc_testcancel ();
394         result = SignalObjectAndWait (*p_mutex, *p_condvar, INFINITE, TRUE);
395
396         /* Reacquire the mutex before returning. */
397         vlc_mutex_lock( p_mutex );
398     }
399     while (result == WAIT_IO_COMPLETION);
400
401     vlc_testcancel ();
402
403     (void)psz_file; (void)i_line;
404
405 #endif
406 }
407
408
409 /*****************************************************************************
410  * vlc_cond_timedwait: wait until condition completion or expiration
411  *****************************************************************************
412  * Returns 0 if object signaled, an error code in case of timeout or error.
413  *****************************************************************************/
414 #define vlc_cond_timedwait( P_COND, P_MUTEX, DEADLINE )                      \
415     __vlc_cond_timedwait( __FILE__, __LINE__, P_COND, P_MUTEX, DEADLINE  )
416
417 static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
418                                         vlc_cond_t *p_condvar,
419                                         vlc_mutex_t *p_mutex,
420                                         mtime_t deadline )
421 {
422 #if defined(LIBVLC_USE_PTHREAD)
423     lldiv_t d = lldiv( deadline, CLOCK_FREQ );
424     struct timespec ts = { d.quot, d.rem * (1000000000 / CLOCK_FREQ) };
425
426     int val = pthread_cond_timedwait (p_condvar, p_mutex, &ts);
427     if (val != ETIMEDOUT)
428         VLC_THREAD_ASSERT ("timed-waiting on condition");
429     return val;
430
431 #elif defined( UNDER_CE )
432     mtime_t delay_ms = (deadline - mdate()) / (CLOCK_FREQ / 1000);
433     DWORD result;
434     if( delay_ms < 0 )
435         delay_ms = 0;
436
437     LeaveCriticalSection( &p_mutex->csection );
438     result = WaitForSingleObject( *p_condvar, delay_ms );
439
440     /* Reacquire the mutex before returning. */
441     vlc_mutex_lock( p_mutex );
442
443     (void)psz_file; (void)i_line;
444
445     return (result == WAIT_TIMEOUT) ? ETIMEDOUT : 0;
446
447 #elif defined( WIN32 )
448     mtime_t total;
449     DWORD result = WAIT_TIMEOUT;
450
451     (void)psz_file; (void)i_line;
452
453     vlc_testcancel ();
454     while ((total = (deadline - mdate ()) > 0))
455     {
456         DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
457         result = SignalObjectAndWait( *p_mutex, *p_condvar,
458                                       delay, TRUE );
459
460         /* Reacquire the mutex before return/cancel. */
461         vlc_mutex_lock (p_mutex);
462         if (result == WAIT_OBJECT_0)
463             return 0; /* Condition signaled! */
464         vlc_testcancel ();
465     }
466     return ETIMEDOUT;
467
468 #endif
469 }
470
471 /*****************************************************************************
472  * vlc_cond_destroy: destroy a condition
473  *****************************************************************************/
474 #define vlc_cond_destroy( P_COND )                                          \
475     __vlc_cond_destroy( __FILE__, __LINE__, P_COND )
476
477 /*****************************************************************************
478  * vlc_threadvar_set: create: set the value of a thread-local variable
479  *****************************************************************************/
480 static inline int vlc_threadvar_set( vlc_threadvar_t * p_tls, void *p_value )
481 {
482     int i_ret;
483
484 #if defined(LIBVLC_USE_PTHREAD)
485     i_ret = pthread_setspecific( *p_tls, p_value );
486
487 #elif defined( UNDER_CE ) || defined( WIN32 )
488     i_ret = TlsSetValue( *p_tls, p_value ) ? EINVAL : 0;
489
490 #endif
491
492     return i_ret;
493 }
494
495 /*****************************************************************************
496  * vlc_threadvar_get: create: get the value of a thread-local variable
497  *****************************************************************************/
498 static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
499 {
500     void *p_ret;
501
502 #if defined(LIBVLC_USE_PTHREAD)
503     p_ret = pthread_getspecific( *p_tls );
504
505 #elif defined( UNDER_CE ) || defined( WIN32 )
506     p_ret = TlsGetValue( *p_tls );
507
508 #endif
509
510     return p_ret;
511 }
512
513 # if defined (_POSIX_SPIN_LOCKS) && ((_POSIX_SPIN_LOCKS - 0) > 0)
514 typedef pthread_spinlock_t vlc_spinlock_t;
515
516 /**
517  * Initializes a spinlock.
518  */
519 static inline int vlc_spin_init (vlc_spinlock_t *spin)
520 {
521     return pthread_spin_init (spin, PTHREAD_PROCESS_PRIVATE);
522 }
523
524 /**
525  * Acquires a spinlock.
526  */
527 static inline void vlc_spin_lock (vlc_spinlock_t *spin)
528 {
529     pthread_spin_lock (spin);
530 }
531
532 /**
533  * Releases a spinlock.
534  */
535 static inline void vlc_spin_unlock (vlc_spinlock_t *spin)
536 {
537     pthread_spin_unlock (spin);
538 }
539
540 /**
541  * Deinitializes a spinlock.
542  */
543 static inline void vlc_spin_destroy (vlc_spinlock_t *spin)
544 {
545     pthread_spin_destroy (spin);
546 }
547
548 #elif defined( WIN32 )
549
550 typedef CRITICAL_SECTION vlc_spinlock_t;
551
552 /**
553  * Initializes a spinlock.
554  */
555 static inline int vlc_spin_init (vlc_spinlock_t *spin)
556 {
557     return !InitializeCriticalSectionAndSpinCount(spin, 4000);
558 }
559
560 /**
561  * Acquires a spinlock.
562  */
563 static inline void vlc_spin_lock (vlc_spinlock_t *spin)
564 {
565     EnterCriticalSection(spin);
566 }
567
568 /**
569  * Releases a spinlock.
570  */
571 static inline void vlc_spin_unlock (vlc_spinlock_t *spin)
572 {
573     LeaveCriticalSection(spin);
574 }
575
576 /**
577  * Deinitializes a spinlock.
578  */
579 static inline void vlc_spin_destroy (vlc_spinlock_t *spin)
580 {
581     DeleteCriticalSection(spin);
582 }
583
584 #else
585
586 /* Fallback to plain mutexes if spinlocks are not available */
587 typedef vlc_mutex_t vlc_spinlock_t;
588
589 static inline int vlc_spin_init (vlc_spinlock_t *spin)
590 {
591     return vlc_mutex_init (spin);
592 }
593
594 # define vlc_spin_lock    vlc_mutex_lock
595 # define vlc_spin_unlock  vlc_mutex_unlock
596 # define vlc_spin_destroy vlc_mutex_destroy
597 #endif
598
599 /**
600  * Issues a full memory barrier.
601  */
602 #if defined (__APPLE__)
603 # include <libkern/OSAtomic.h> /* OSMemoryBarrier() */
604 #endif
605 static inline void barrier (void)
606 {
607 #if defined (__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
608     __sync_synchronize ();
609 #elif defined(__APPLE__)
610     OSMemoryBarrier ();
611 #elif defined(__powerpc__)
612     asm volatile ("sync":::"memory");
613 #elif defined(__i386__)
614     asm volatile ("mfence":::"memory");
615 #else
616     vlc_spinlock_t spin;
617     vlc_spin_init (&spin);
618     vlc_spin_lock (&spin);
619     vlc_spin_unlock (&spin);
620     vlc_spin_destroy (&spin);
621 #endif
622 }
623
624 /*****************************************************************************
625  * vlc_thread_create: create a thread
626  *****************************************************************************/
627 #define vlc_thread_create( P_THIS, PSZ_NAME, FUNC, PRIORITY, WAIT )         \
628     __vlc_thread_create( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PSZ_NAME, FUNC, PRIORITY, WAIT )
629
630 /*****************************************************************************
631  * vlc_thread_set_priority: set the priority of the calling thread
632  *****************************************************************************/
633 #define vlc_thread_set_priority( P_THIS, PRIORITY )                         \
634     __vlc_thread_set_priority( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PRIORITY )
635
636 /*****************************************************************************
637  * vlc_thread_join: wait until a thread exits
638  *****************************************************************************/
639 #define vlc_thread_join( P_THIS )                                           \
640     __vlc_thread_join( VLC_OBJECT(P_THIS) )
641
642 #endif /* !_VLC_THREADS_H */