3 Copyright (c) 2003-2015 HandBrake Team
4 This file is part of the HandBrake source code
5 Homepage: <http://handbrake.fr/>.
6 It may be used under the terms of the GNU General Public License v2.
7 For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
13 #define TASKSET_POSIX_COMPLIANT 1
17 typedef struct hb_taskset_s
{
21 hb_thread_t
** task_threads
;
22 uint8_t * task_threads_args
;
23 uint32_t * task_begin_bitmap
; // Threads can begin
24 uint32_t * task_complete_bitmap
; // Threads have completed
25 uint32_t * task_stop_bitmap
; // Threads should exit
26 hb_lock_t
* task_cond_lock
; // Held during condition tests
27 hb_cond_t
* task_begin
; // Threads can begin work
28 hb_cond_t
* task_complete
; // Threads have finished work.
31 int taskset_init( taskset_t
*, int /*thread_count*/, size_t /*user_arg_size*/ );
32 void taskset_cycle( taskset_t
* );
33 void taskset_fini( taskset_t
* );
35 int taskset_thread_spawn( taskset_t
*, int /*thr_idx*/, const char * /*descr*/,
36 thread_func_t
*, int /*priority*/ );
37 void taskset_thread_wait4start( taskset_t
*, int );
38 void taskset_thread_complete( taskset_t
*, int );
40 static inline void *taskset_thread_args( taskset_t
*, int );
41 static inline int taskset_thread_stop( taskset_t
*, int );
44 taskset_thread_args( taskset_t
*ts
, int thr_idx
)
46 return( ts
->task_threads_args
+ ( ts
->arg_size
* thr_idx
) );
50 taskset_thread_stop( taskset_t
*ts
, int thr_idx
)
52 return bit_is_set( ts
->task_stop_bitmap
, thr_idx
);
55 #endif /* HB_TASKSET_H */