Threading

Thread Pooling and Monitoring. More...

## Data Structures

struct | ToolsCorePool
| Public interface of the shared thread pool. More...

## Macros

#define | TOOLS_CORE_PROP_TPOOL "tcs_prop_thread_pool"

## Typedefs

typedef void(* | ToolsCorePoolCb) (ToolsAppCtx *ctx, gpointer data)
typedef struct ToolsCorePool | ToolsCorePool
| Public interface of the shared thread pool.

## Detailed Description

Thread Pooling and Monitoring.

vmtoolsd provides a worker thread pool for use by plugins. This pool is shared among all plugins, and is configurable from the Tools config file. Plugins can submit tasks to the thread pool by using one of the inline functions declared in this header.

The thread pool is a shared resource, so code whose execution time may be very long might want to, instead, create a dedicated thread for execution. The shared thread pool also provides a facility to more easily do that, with the lifecycle of the new thread managed by the thread pool so that it is properly notified of service shutdown.

Finally, depending on the configuration, the shared thread pool might not be a thread pool at all: if the configuration has disabled threading, tasks destined to the shared thread pool will be executed on the main service thread.

## Typedef Documentation

## ToolsCorePool

typedef struct ToolsCorePool ToolsCorePool

Public interface of the shared thread pool.

This struct is published in the service's TOOLS_CORE_PROP_TPOOL property, and contains function pointers to the internal implementation of the thread pool's functions. In general, applications may prefer to use the inline functions provided below instead, since they take care of some of the boilerplate code.

## ToolsCorePoolCb

typedef void(* ToolsCorePoolCb) (ToolsAppCtx *ctx, gpointer data)

Type of callback function used to register tasks with the pool.