20#define BLENDER_MAX_THREADS 1024
84#define BLI_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
106#elif defined(__APPLE__)
108#elif defined(_MSC_VER)
109typedef volatile unsigned int SpinLock;
121#define THREAD_LOCK_READ 1
122#define THREAD_LOCK_WRITE 2
124#define BLI_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER
181#if defined(__APPLE__)
182# define ThreadLocal(type) pthread_key_t
183# define BLI_thread_local_create(name) pthread_key_create(&name, NULL)
184# define BLI_thread_local_delete(name) pthread_key_delete(name)
185# define BLI_thread_local_get(name) pthread_getspecific(name)
186# define BLI_thread_local_set(name, value) pthread_setspecific(name, value)
189# define ThreadLocal(type) __declspec(thread) type
191# define ThreadLocal(type) __thread type
193# define BLI_thread_local_create(name)
194# define BLI_thread_local_delete(name)
195# define BLI_thread_local_get(name) name
196# define BLI_thread_local_set(name, value) name = value
void BLI_condition_notify_all(ThreadCondition *cond)
bool BLI_mutex_trylock(ThreadMutex *mutex)
void BLI_rw_mutex_end(ThreadRWMutex *mutex)
TicketMutex * BLI_ticket_mutex_alloc(void)
void BLI_thread_queue_push(ThreadQueue *queue, void *work)
ThreadRWMutex * BLI_rw_mutex_alloc(void)
pthread_spinlock_t SpinLock
void * BLI_thread_queue_pop(ThreadQueue *queue)
void BLI_thread_unlock(int type)
void BLI_ticket_mutex_unlock(TicketMutex *ticket)
void BLI_mutex_end(ThreadMutex *mutex)
void BLI_mutex_free(ThreadMutex *mutex)
ThreadQueue * BLI_thread_queue_init(void)
pthread_rwlock_t ThreadRWMutex
void BLI_thread_lock(int type)
void BLI_threadpool_remove(struct ListBase *threadbase, void *callerdata)
void BLI_threadapi_init(void)
ThreadMutex * BLI_mutex_alloc(void)
bool BLI_ticket_mutex_lock_check_recursive(TicketMutex *ticket)
void BLI_condition_wait(ThreadCondition *cond, ThreadMutex *mutex)
void BLI_threadpool_init(struct ListBase *threadbase, void *(*do_thread)(void *), int tot)
void BLI_condition_wait_global_mutex(ThreadCondition *cond, int type)
void BLI_mutex_init(ThreadMutex *mutex)
void BLI_system_num_threads_override_set(int num)
pthread_cond_t ThreadCondition
void BLI_condition_end(ThreadCondition *cond)
int BLI_system_thread_count(void)
void BLI_thread_queue_free(ThreadQueue *queue)
int BLI_system_num_threads_override_get(void)
void BLI_threadapi_exit(void)
void BLI_threadpool_end(struct ListBase *threadbase)
void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode)
void BLI_ticket_mutex_lock(TicketMutex *ticket)
void BLI_condition_notify_one(ThreadCondition *cond)
bool BLI_thread_queue_is_empty(ThreadQueue *queue)
void BLI_ticket_mutex_free(TicketMutex *ticket)
int BLI_thread_is_main(void)
void BLI_condition_init(ThreadCondition *cond)
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_thread_queue_nowait(ThreadQueue *queue)
void BLI_thread_queue_wait_finish(ThreadQueue *queue)
void BLI_mutex_unlock(ThreadMutex *mutex)
void BLI_rw_mutex_init(ThreadRWMutex *mutex)
void BLI_threadpool_remove_index(struct ListBase *threadbase, int index)
void BLI_threadpool_clear(struct ListBase *threadbase)
int BLI_available_threads(struct ListBase *threadbase)
int BLI_threadpool_available_thread_index(struct ListBase *threadbase)
void BLI_spin_init(SpinLock *spin)
void BLI_spin_unlock(SpinLock *spin)
void BLI_spin_lock(SpinLock *spin)
void BLI_rw_mutex_free(ThreadRWMutex *mutex)
void BLI_threadpool_insert(struct ListBase *threadbase, void *callerdata)
void BLI_rw_mutex_unlock(ThreadRWMutex *mutex)
pthread_mutex_t ThreadMutex
void BLI_spin_end(SpinLock *spin)
void * BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
int BLI_thread_queue_len(ThreadQueue *queue)