Features: Chafa Reference Manual

## Features Features — Platform-specific feature support |

## Functions

ChafaFeatures | chafa_get_builtin_features ()
ChafaFeatures | chafa_get_supported_features ()
gchar * | chafa_describe_features ()
gint | chafa_get_n_threads ()
void | chafa_set_n_threads ()
gint | chafa_get_n_actual_threads ()

## Types and Values

enum | ChafaFeatures

## Description

Chafa supports a few platform-specific acceleration features. These will be built in and used automatically when available. You can get information about the available features through the function calls documented in this section.

## Functions

### chafa_get_builtin_features ()

    ChafaFeatures
    chafa_get_builtin_features (void);

Gets a list of the platform-specific features this library was built with.

#### Returns

A set of flags indicating features present.

### chafa_get_supported_features ()

    ChafaFeatures
    chafa_get_supported_features (void);

Gets a list of the platform-specific features that are built in and usable on the runtime platform.

#### Returns

A set of flags indicating usable features

### chafa_describe_features ()

    gchar *
    chafa_describe_features (ChafaFeatures features);

Takes a set of flags potentially returned from `chafa_get_builtin_features()` or `chafa_get_supported_features()` and generates a human-readable ASCII string descriptor.

#### Parameters

features | A set of flags representing features |

#### Returns

A string describing the features. This must be freed by caller.

### chafa_get_n_threads ()

    gint
    chafa_get_n_threads (void);

Queries the maximum number of worker threads to use for parallel processing.

#### Returns

The number of threads, or -1 if determined automatically

### chafa_set_n_threads ()

    void
    chafa_set_n_threads (gint n);

Sets the maximum number of worker threads to use for parallel processing, or -1 to determine this automatically. The default is -1.

Setting this to 0 or 1 will avoid using thread pools and instead perform all processing in the main thread.

#### Parameters

n | Number of threads |

### chafa_get_n_actual_threads ()

    gint
    chafa_get_n_actual_threads (void);

Queries the number of worker threads that will actually be used for parallel processing.

#### Returns

Number of threads, always >= 1

## Types and Values

### enum ChafaFeatures

#### Members

CHAFA_FEATURE_MMX | Flag indicating MMX support. |
CHAFA_FEATURE_SSE41 | Flag indicating SSE 4.1 support. |
CHAFA_FEATURE_POPCNT | Flag indicating popcnt support. |
CHAFA_FEATURE_AVX2 | Flag indicating AVX2 support. |