All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Typedefs | Functions
as_thread_pool.h File Reference
#include <aerospike/as_std.h>
#include <citrusleaf/cf_queue.h>
#include <pthread.h>
+ Include dependency graph for as_thread_pool.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  as_thread_pool


typedef void(* as_fini_fn )(void)
typedef void(* as_task_fn )(void *user_data)


int as_thread_pool_destroy (as_thread_pool *pool)
int as_thread_pool_init (as_thread_pool *pool, uint32_t thread_size)
int as_thread_pool_queue_task (as_thread_pool *pool, as_task_fn task_fn, void *task)

Typedef Documentation

typedef void(* as_fini_fn)(void)

Thread finalization function callback.

Definition at line 41 of file as_thread_pool.h.

typedef void(* as_task_fn)(void *user_data)

Task function callback.

Definition at line 35 of file as_thread_pool.h.

Function Documentation

int as_thread_pool_destroy ( as_thread_pool pool)

Destroy thread pool.

Returns: 0 : Success -1 : Failed to lock mutex -2 : Pool has already been closed

int as_thread_pool_init ( as_thread_pool pool,
uint32_t  thread_size 

Initialize variable task thread pool and start thread_size threads. Multiple task types can be handled in variable task thread pools.

Returns: 0 : Success -1 : Failed to initialize mutex lock -2 : Failed to lock mutex -3 : Some threads failed to start

int as_thread_pool_queue_task ( as_thread_pool pool,
as_task_fn  task_fn,
void *  task 

Queue a variable task onto thread pool.

Returns: 0 : Success -1 : No threads are running to process task. -2 : Failed to push task onto dispatch queue