Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_task.h
| Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | |||||
| BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings); | BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings); | ||||
| void BLI_task_parallel_range(const int start, | void BLI_task_parallel_range(const int start, | ||||
| const int stop, | const int stop, | ||||
| void *userdata, | void *userdata, | ||||
| TaskParallelRangeFunc func, | TaskParallelRangeFunc func, | ||||
| const TaskParallelSettings *settings); | const TaskParallelSettings *settings); | ||||
| typedef void (*TaskParallelListbaseFunc)(void *userdata, struct Link *iter, int index); | /* This data is shared between all tasks, its access needs thread lock or similar protection. */ | ||||
| typedef struct TaskParallelIteratorStateShared { | |||||
| /* Maximum amount of items to acquire at once. */ | |||||
| int chunk_size; | |||||
| /* Next item to be acquired. */ | |||||
| void *next_item; | |||||
| /* Index of the next item to be acquired. */ | |||||
| int next_index; | |||||
| /* Indicates that end of iteration has been reached. */ | |||||
sergey: That or this data? | |||||
Done Inline ActionsEeeeeh... Does it matter at all here? mont29: Eeeeeh... Does it matter at all here? | |||||
| bool is_finished; | |||||
| /* Helper lock to protect access to this data in iterator getter callback, | |||||
| * can be ignored (if the callback implements its own protection system, using atomics e.g.). | |||||
| * Will be NULL when iterator is actually processed in a single thread. */ | |||||
| SpinLock *spin_lock; | |||||
| } TaskParallelIteratorStateShared; | |||||
Done Inline ActionsTask or thread? sergey: Task or thread? | |||||
| typedef void (*TaskParallelIteratorIterFunc)(void *__restrict userdata, | |||||
| const TaskParallelTLS *__restrict tls, | |||||
| void **r_next_item, | |||||
| int *r_next_index, | |||||
| bool *r_do_abort); | |||||
| typedef void (*TaskParallelIteratorFunc)(void *__restrict userdata, | |||||
| void *item, | |||||
| int index, | |||||
| const TaskParallelTLS *__restrict tls); | |||||
| void BLI_task_parallel_iterator(void *userdata, | |||||
| TaskParallelIteratorIterFunc iter_func, | |||||
| void *init_item, | |||||
| const int init_index, | |||||
| const int tot_items, | |||||
| TaskParallelIteratorFunc func, | |||||
| const TaskParallelSettings *settings); | |||||
| void BLI_task_parallel_listbase(struct ListBase *listbase, | void BLI_task_parallel_listbase(struct ListBase *listbase, | ||||
| void *userdata, | void *userdata, | ||||
| TaskParallelListbaseFunc func, | TaskParallelIteratorFunc func, | ||||
| const bool use_threading); | const TaskParallelSettings *settings); | ||||
| typedef struct MempoolIterData MempoolIterData; | typedef struct MempoolIterData MempoolIterData; | ||||
| typedef void (*TaskParallelMempoolFunc)(void *userdata, MempoolIterData *iter); | typedef void (*TaskParallelMempoolFunc)(void *userdata, MempoolIterData *iter); | ||||
| void BLI_task_parallel_mempool(struct BLI_mempool *mempool, | void BLI_task_parallel_mempool(struct BLI_mempool *mempool, | ||||
| void *userdata, | void *userdata, | ||||
| TaskParallelMempoolFunc func, | TaskParallelMempoolFunc func, | ||||
| const bool use_threading); | const bool use_threading); | ||||
| Show All 15 Lines | |||||
That or this data?