## prelude-async

prelude-async

## Synopsis

    enum                prelude_async_flags_t;
    void                (*prelude_async_callback_t)         (void *object,
                                                             void *data);
    #define             PRELUDE_ASYNC_OBJECT
                        prelude_async_object_t;
    int                 prelude_async_init                  (void);
    prelude_async_flags_t  prelude_async_get_flags          (void);
    void                prelude_async_set_flags             (prelude_async_flags_t flags);
    void                prelude_async_add                   (prelude_async_object_t *obj);
    void                prelude_async_del                   (prelude_async_object_t *obj);
    void                prelude_async_exit                  (void);

## Description

## Details

### enum prelude_async_flags_t

    typedef enum {
            PRELUDE_ASYNC_FLAGS_TIMER   = 0x01
    } prelude_async_flags_t;

This provides asynchronous timer. When enabled, the heartbeat function (and user specified callback, if any) will be called automatically, from an asynchronous thread.

If you use this flags, you won't need to call `prelude_wake_up_timer()` anymore.

`PRELUDE_ASYNC_FLAGS_TIMER` | Enable asynchronous timer.

### prelude_async_callback_t ()

    void                (*prelude_async_callback_t)         (void *object,
                                                             void *data);

`object` : |
`data` : |

### PRELUDE_ASYNC_OBJECT

    #define             PRELUDE_ASYNC_OBJECT

### prelude_async_object_t

    typedef struct {
            PRELUDE_ASYNC_OBJECT;
    } prelude_async_object_t;

### prelude_async_init ()

    int                 prelude_async_init                  (void);

Initialize the asynchronous subsystem.

Returns : | 0 on success, -1 if an error occured.

### prelude_async_get_flags ()

    prelude_async_flags_t  prelude_async_get_flags          (void);

Retrieves flags from the asynchronous subsystem

Returns : | asynchronous flags

### prelude_async_set_flags ()

    void                prelude_async_set_flags             (prelude_async_flags_t flags);

Sets flags to the asynchronous subsystem.

`flags` : | flags you want to set

### prelude_async_add ()

    void                prelude_async_add                   (prelude_async_object_t *obj);

Adds `obj` to the asynchronous processing list.

`obj` : | Pointer to a prelude_async_t object.

### prelude_async_del ()

    void                prelude_async_del                   (prelude_async_object_t *obj);

Deletes `obj` from the asynchronous processing list.

`obj` : | Pointer to a prelude_async_t object.

### prelude_async_exit ()

    void                prelude_async_exit                  (void);