Blender V2.61 - r43446
Defines | Typedefs | Functions

BLI_threads.h File Reference

#include <pthread.h>

Go to the source code of this file.

Defines

#define BLENDER_MAX_THREADS   64
#define LOCK_IMAGE   0
#define LOCK_PREVIEW   1
#define LOCK_VIEWER   2
#define LOCK_CUSTOM1   3
#define LOCK_RCACHE   4
#define LOCK_OPENGL   5
#define LOCK_NODES   6
#define LOCK_MOVIECLIP   7
#define BLI_MUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER
#define THREAD_LOCK_READ   1
#define THREAD_LOCK_WRITE   2

Typedefs

typedef pthread_mutex_t ThreadMutex
typedef pthread_rwlock_t ThreadRWMutex
typedef struct ThreadQueue ThreadQueue

Functions

void BLI_threadapi_init (void)
void BLI_init_threads (struct ListBase *threadbase, void *(*do_thread)(void *), int tot)
int BLI_available_threads (struct ListBase *threadbase)
int BLI_available_thread_index (struct ListBase *threadbase)
void BLI_insert_thread (struct ListBase *threadbase, void *callerdata)
void BLI_remove_thread (struct ListBase *threadbase, void *callerdata)
void BLI_remove_thread_index (struct ListBase *threadbase, int index)
void BLI_remove_threads (struct ListBase *threadbase)
void BLI_end_threads (struct ListBase *threadbase)
int BLI_thread_is_main (void)
void BLI_begin_threaded_malloc (void)
void BLI_end_threaded_malloc (void)
int BLI_system_thread_count (void)
void BLI_lock_thread (int type)
void BLI_unlock_thread (int type)
void BLI_mutex_init (ThreadMutex *mutex)
void BLI_mutex_lock (ThreadMutex *mutex)
void BLI_mutex_unlock (ThreadMutex *mutex)
void BLI_mutex_end (ThreadMutex *mutex)
void BLI_rw_mutex_init (ThreadRWMutex *mutex)
void BLI_rw_mutex_lock (ThreadRWMutex *mutex, int mode)
void BLI_rw_mutex_unlock (ThreadRWMutex *mutex)
void BLI_rw_mutex_end (ThreadRWMutex *mutex)
struct ThreadedWorkerBLI_create_worker (void *(*do_thread)(void *), int tot, int sleep_time)
void BLI_end_worker (struct ThreadedWorker *worker)
void BLI_destroy_worker (struct ThreadedWorker *worker)
void BLI_insert_work (struct ThreadedWorker *worker, void *param)
ThreadQueueBLI_thread_queue_init (void)
void BLI_thread_queue_free (ThreadQueue *queue)
void BLI_thread_queue_push (ThreadQueue *queue, void *work)
void * BLI_thread_queue_pop (ThreadQueue *queue)
void * BLI_thread_queue_pop_timeout (ThreadQueue *queue, int ms)
int BLI_thread_queue_size (ThreadQueue *queue)
void BLI_thread_queue_nowait (ThreadQueue *queue)

Detailed Description

Definition in file BLI_threads.h.


Define Documentation

#define BLENDER_MAX_THREADS   64
#define BLI_MUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER

Definition at line 86 of file BLI_threads.h.

#define LOCK_CUSTOM1   3
#define LOCK_IMAGE   0
#define LOCK_MOVIECLIP   7
#define LOCK_NODES   6
#define LOCK_OPENGL   5
#define LOCK_PREVIEW   1
#define LOCK_RCACHE   4

Definition at line 75 of file BLI_threads.h.

Referenced by BLI_lock_thread(), and BLI_unlock_thread().

#define LOCK_VIEWER   2
#define THREAD_LOCK_READ   1

Definition at line 95 of file BLI_threads.h.

Referenced by BLI_rw_mutex_lock(), RE_AcquireResultImage(), and RE_AcquireResultRead().

#define THREAD_LOCK_WRITE   2

Typedef Documentation

typedef pthread_mutex_t ThreadMutex

Definition at line 85 of file BLI_threads.h.

typedef struct ThreadQueue ThreadQueue

Definition at line 131 of file BLI_threads.h.

typedef pthread_rwlock_t ThreadRWMutex

Definition at line 98 of file BLI_threads.h.


Function Documentation

int BLI_available_thread_index ( struct ListBase threadbase)

Definition at line 197 of file threads.c.

References ThreadSlot::avail, ListBase::first, and ThreadSlot::next.

Referenced by BLI_insert_work(), and threaded_tile_processor().

int BLI_available_threads ( struct ListBase threadbase)
void BLI_begin_threaded_malloc ( void  )
struct ThreadedWorker* BLI_create_worker ( void *(*)(void *)  do_thread,
int  tot,
int  sleep_time 
) [read]
void BLI_destroy_worker ( struct ThreadedWorker worker)

Definition at line 484 of file threads.c.

References BLI_end_worker(), BLI_freelistN(), MEM_freeN(), and ThreadedWorker::threadbase.

Referenced by RIG_freeRigGraph().

void BLI_end_threaded_malloc ( void  )

Definition at line 680 of file threads.c.

References MEM_set_lock_callback(), NULL, and thread_levels.

Referenced by BKE_tracking_context_free(), and dynamicPaint_paintParticles().

void BLI_end_threads ( struct ListBase threadbase)
void BLI_end_worker ( struct ThreadedWorker worker)

Definition at line 479 of file threads.c.

References BLI_remove_threads(), and ThreadedWorker::threadbase.

Referenced by BLI_destroy_worker(), and finishRetarget().

void BLI_init_threads ( struct ListBase threadbase,
void *(*)(void *)  do_thread,
int  tot 
)
void BLI_insert_thread ( struct ListBase threadbase,
void *  callerdata 
)
void BLI_insert_work ( struct ThreadedWorker worker,
void *  param 
)
void BLI_lock_thread ( int  type)
void BLI_mutex_end ( ThreadMutex mutex)

Definition at line 395 of file threads.c.

Referenced by imb_tile_cache_exit(), and proxy_freejob().

void BLI_mutex_init ( ThreadMutex mutex)

Definition at line 380 of file threads.c.

References NULL.

Referenced by imb_tile_cache_init(), IMB_tile_cache_params(), and seq_proxy_build_job().

void BLI_mutex_lock ( ThreadMutex mutex)
void BLI_mutex_unlock ( ThreadMutex mutex)
void BLI_remove_thread ( struct ListBase threadbase,
void *  callerdata 
)
void BLI_remove_thread_index ( struct ListBase threadbase,
int  index 
)
void BLI_remove_threads ( struct ListBase threadbase)
void BLI_rw_mutex_end ( ThreadRWMutex mutex)

Definition at line 420 of file threads.c.

Referenced by RE_FreeRender().

void BLI_rw_mutex_init ( ThreadRWMutex mutex)

Definition at line 402 of file threads.c.

References NULL.

Referenced by RE_NewRender().

void BLI_rw_mutex_lock ( ThreadRWMutex mutex,
int  mode 
)
void BLI_rw_mutex_unlock ( ThreadRWMutex mutex)
int BLI_system_thread_count ( void  )
int BLI_thread_is_main ( void  )
void BLI_thread_queue_free ( ThreadQueue queue)
ThreadQueue* BLI_thread_queue_init ( void  )
void BLI_thread_queue_nowait ( ThreadQueue queue)
void* BLI_thread_queue_pop ( ThreadQueue queue)
void* BLI_thread_queue_pop_timeout ( ThreadQueue queue,
int  ms 
)
void BLI_thread_queue_push ( ThreadQueue queue,
void *  work 
)
int BLI_thread_queue_size ( ThreadQueue queue)
void BLI_threadapi_init ( void  )

Definition at line 142 of file threads.c.

References mainid.

Referenced by main().

void BLI_unlock_thread ( int  type)