- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# thread pool
[utilities]

## Typedefs
typedef struct axutil_thread_pool | axutil_thread_pool_t
## Functions
AXIS2_EXTERN axutil_thread_t * | axutil_thread_pool_get_thread (axutil_thread_pool_t *pool, axutil_thread_start_t func, void *data)
AXIS2_EXTERN axis2_status_t | axutil_thread_pool_join_thread (axutil_thread_pool_t *pool, axutil_thread_t *thd)
AXIS2_EXTERN axis2_status_t | axutil_thread_pool_exit_thread (axutil_thread_pool_t *pool, axutil_thread_t *thd)
AXIS2_EXTERN axis2_status_t | axutil_thread_pool_thread_detach (axutil_thread_pool_t *pool, axutil_thread_t *thd)
AXIS2_EXTERN void | axutil_thread_pool_free (axutil_thread_pool_t *pool)
AXIS2_EXTERN axutil_thread_pool_t * | axutil_thread_pool_init (axutil_allocator_t *allocator)
AXIS2_EXTERN struct axutil_env * | axutil_init_thread_env (const struct axutil_env *system_env)
AXIS2_EXTERN void | axutil_free_thread_env (struct axutil_env *thread_env)

## Function Documentation

AXIS2_EXTERN void axutil_free_thread_env | ( | struct axutil_env * | thread_env | ) |

This function can be used to free the environment that was used in a thread function

AXIS2_EXTERN struct axutil_env* axutil_init_thread_env | ( | const struct axutil_env * | system_env | ) | `[read]`

This function can be used to initialize the environment in case of spawning a new thread via a thread function

AXIS2_EXTERN axis2_status_t axutil_thread_pool_exit_thread | ( | axutil_thread_pool_t * | pool,
|  | axutil_thread_t * | thd |
| ) |  |  |

Stop the execution of current thread

Parameters:

  | thd | thread to be stopped

Returns:
  status of the operation

AXIS2_EXTERN void axutil_thread_pool_free | ( | axutil_thread_pool_t * | pool | ) |

Frees resources used by thread_pool

Parameters:

  | pool | thread_pool to be freed

AXIS2_EXTERN axutil_thread_t* axutil_thread_pool_get_thread | ( | axutil_thread_pool_t * | pool,
|  | axutil_thread_start_t | func,
|  | void * | data |
| ) |  |  |

Retrives a thread from the thread pool

Parameters:

  | func | function to be executed in the new thread
  | data | arguments to be passed to the function

Returns:
  pointer to a thread in ready state.

AXIS2_EXTERN axutil_thread_pool_t* axutil_thread_pool_init | ( | axutil_allocator_t * | allocator | ) |

Initializes (creates) an thread_pool.

Parameters:

  | allocator | user defined allocator for the memory allocation.

Returns:
  initialized thread_pool. NULL on error.

AXIS2_EXTERN axis2_status_t axutil_thread_pool_join_thread | ( | axutil_thread_pool_t * | pool,
|  | axutil_thread_t * | thd |
| ) |  |  |

Blocks until the desired thread stops executing.

Parameters:

  | thd | The thread to joined

Returns:
  status of the operation

AXIS2_EXTERN axis2_status_t axutil_thread_pool_thread_detach | ( | axutil_thread_pool_t * | pool,
|  | axutil_thread_t * | thd |
| ) |  |  |

Detaches a thread

Parameters:

  | thd | thread to be detached

Returns:
  status of the operation