## e-msgport

e-msgport

## Synopsis

                        EDListNode;
                        EDList;
    #define             E_DLIST_INITIALISER                 (l)
    void                e_dlist_init                        (EDList *v);
    EDListNode*         e_dlist_addhead                     (EDList *l,
                                                             EDListNode *n);
    EDListNode*         e_dlist_addtail                     (EDList *l,
                                                             EDListNode *n);
    EDListNode*         e_dlist_remove                      (EDListNode *n);
    EDListNode*         e_dlist_remhead                     (EDList *l);
    EDListNode*         e_dlist_remtail                     (EDList *l);
    int                 e_dlist_empty                       (EDList *l);
    int                 e_dlist_length                      (EDList *l);
                        EMCache;
                        EMCacheNode;
    EMCache*            em_cache_new                        (time_t timeout,
                                                             size_t nodesize,
                                                             GFreeFunc nodefree);
    void                em_cache_destroy                    (EMCache *emc);
    EMCacheNode*        em_cache_lookup                     (EMCache *emc,
                                                             const char *key);
    EMCacheNode*        em_cache_node_new                   (EMCache *emc,
                                                             const char *key);
    void                em_cache_node_unref                 (EMCache *emc,
                                                             EMCacheNode *n);
    void                em_cache_add                        (EMCache *emc,
                                                             EMCacheNode *n);
    void                em_cache_clear                      (EMCache *emc);
                        EMsgPort;
                        EMsg;
    EMsgPort*           e_msgport_new                       (void);
    void                e_msgport_destroy                   (EMsgPort *mp);
    int                 e_msgport_fd                        (EMsgPort *mp);
    struct PRFileDesc*  e_msgport_prfd                      (EMsgPort *mp);
    void                e_msgport_put                       (EMsgPort *mp,
                                                             EMsg *msg);
    EMsg*               e_msgport_wait                      (EMsgPort *mp);
    EMsg*               e_msgport_get                       (EMsgPort *mp);
    void                e_msgport_reply                     (EMsg *msg);
                        EThread;
    enum                e_thread_t;
    void                (*EThreadFunc)                      (EThread *,
                                                             EMsg *,
                                                             void *data);
    EThread*            e_thread_new                        (e_thread_t type);
    void                e_thread_destroy                    (EThread *e);
    void                e_thread_set_queue_limit            (EThread *e,
                                                             int limit);
    void                e_thread_set_msg_lost               (EThread *e,
                                                             EThreadFunc destroy,
                                                             void *data);
    void                e_thread_set_msg_destroy            (EThread *e,
                                                             EThreadFunc destroy,
                                                             void *data);
    void                e_thread_set_reply_port             (EThread *e,
                                                             EMsgPort *reply_port);
    void                e_thread_set_msg_received           (EThread *e,
                                                             EThreadFunc received,
                                                             void *data);
    void                e_thread_put                        (EThread *e,
                                                             EMsg *msg);
    int                 e_thread_busy                       (EThread *e);
                        EMutex;
    enum                e_mutex_t;
    EMutex*             e_mutex_new                         (e_mutex_t type);
    int                 e_mutex_destroy                     (EMutex *m);
    int                 e_mutex_lock                        (EMutex *m);
    int                 e_mutex_unlock                      (EMutex *m);
    void                e_mutex_assert_locked               (EMutex *m);
    int                 e_mutex_cond_wait                   (void *cond,
                                                             EMutex *m);

## Description

## Details

### EDListNode

    typedef struct {
    	struct _EDListNode *next;
    	struct _EDListNode *prev;
    } EDListNode;

### EDList

    typedef struct {
    	struct _EDListNode *head;
    	struct _EDListNode *tail;
    	struct _EDListNode *tailpred;
    } EDList;

### E_DLIST_INITIALISER()

    #define E_DLIST_INITIALISER(l) { (EDListNode *)&l.tail, NULL, (EDListNode *)&l.head }

`l` : |

### e_dlist_init ()

    void                e_dlist_init                        (EDList *v);

`v` : |

### e_dlist_addhead ()

    EDListNode*         e_dlist_addhead                     (EDList *l,
                                                             EDListNode *n);

`l` : |
`n` : |
Returns : |

### e_dlist_addtail ()

    EDListNode*         e_dlist_addtail                     (EDList *l,
                                                             EDListNode *n);

`l` : |
`n` : |
Returns : |

### e_dlist_remove ()

    EDListNode*         e_dlist_remove                      (EDListNode *n);

`n` : |
Returns : |

### e_dlist_remhead ()

    EDListNode*         e_dlist_remhead                     (EDList *l);

`l` : |
Returns : |

### e_dlist_remtail ()

    EDListNode*         e_dlist_remtail                     (EDList *l);

`l` : |
Returns : |

### e_dlist_empty ()

    int                 e_dlist_empty                       (EDList *l);

`l` : |
Returns : |

### e_dlist_length ()

    int                 e_dlist_length                      (EDList *l);

`l` : |
Returns : |

### EMCache

    typedef struct _EMCache EMCache;

### EMCacheNode

    typedef struct {
    	struct _EMCacheNode *next, *prev;
    	char *key;
    	int ref_count;
    	time_t stamp;
    } EMCacheNode;

### em_cache_new ()

    EMCache*            em_cache_new                        (time_t timeout,
                                                             size_t nodesize,
                                                             GFreeFunc nodefree);

`timeout` : |
`nodesize` : |
`nodefree` : |
Returns : |

### em_cache_destroy ()

    void                em_cache_destroy                    (EMCache *emc);

`emc` : |

### em_cache_lookup ()

    EMCacheNode*        em_cache_lookup                     (EMCache *emc,
                                                             const char *key);

`emc` : |
`key` : |
Returns : |

### em_cache_node_new ()

    EMCacheNode*        em_cache_node_new                   (EMCache *emc,
                                                             const char *key);

`emc` : |
`key` : |
Returns : |

### em_cache_node_unref ()

    void                em_cache_node_unref                 (EMCache *emc,
                                                             EMCacheNode *n);

`emc` : |
`n` : |

### em_cache_add ()

    void                em_cache_add                        (EMCache *emc,
                                                             EMCacheNode *n);

`emc` : |
`n` : |

### em_cache_clear ()

    void                em_cache_clear                      (EMCache *emc);

`emc` : |

### EMsgPort

    typedef struct _EMsgPort EMsgPort;

### EMsg

    typedef struct {
    	EDListNode ln;
    	EMsgPort *reply_port;
    	gint flags;
    } EMsg;

### e_msgport_new ()

    EMsgPort*           e_msgport_new                       (void);

Returns : |

### e_msgport_destroy ()

    void                e_msgport_destroy                   (EMsgPort *mp);

`mp` : |

### e_msgport_fd ()

    int                 e_msgport_fd                        (EMsgPort *mp);

`mp` : |
Returns : |

### e_msgport_prfd ()

    struct PRFileDesc*  e_msgport_prfd                      (EMsgPort *mp);

`mp` : |
Returns : |

### e_msgport_put ()

    void                e_msgport_put                       (EMsgPort *mp,
                                                             EMsg *msg);

`mp` : |
`msg` : |

### e_msgport_wait ()

    EMsg*               e_msgport_wait                      (EMsgPort *mp);

`mp` : |
Returns : |

### e_msgport_get ()

    EMsg*               e_msgport_get                       (EMsgPort *mp);

`mp` : |
Returns : |

### e_msgport_reply ()

    void                e_msgport_reply                     (EMsg *msg);

`msg` : |

### EThread

    typedef struct _EThread EThread;

### Warning

`EThread` is deprecated and should not be used in newly-written code.

### enum e_thread_t

    typedef enum {
    	E_THREAD_QUEUE = 0,	/* run one by one, until done, if the queue_limit is reached, discard new request */
    	E_THREAD_DROP,		/* run one by one, until done, if the queue_limit is reached, discard oldest requests */
    	E_THREAD_NEW,		/* always run in a new thread, if the queue limit is reached, new requests are
    				   stored in the queue until a thread becomes available for it, creating a thread pool */
    } e_thread_t;

### Warning

`e_thread_t` is deprecated and should not be used in newly-written code.

### EThreadFunc ()

    void                (*EThreadFunc)                      (EThread *,
                                                             EMsg *,
                                                             void *data);

### Warning

`EThreadFunc` is deprecated and should not be used in newly-written code.

`Param1` : |
`Param2` : |
`data` : |

### e_thread_new ()

    EThread*            e_thread_new                        (e_thread_t type);

### Warning

`e_thread_new` is deprecated and should not be used in newly-written code.

`type` : |
Returns : |

### e_thread_destroy ()

    void                e_thread_destroy                    (EThread *e);

### Warning

`e_thread_destroy` is deprecated and should not be used in newly-written code.

`e` : |

### e_thread_set_queue_limit ()

    void                e_thread_set_queue_limit            (EThread *e,
                                                             int limit);

### Warning

`e_thread_set_queue_limit` is deprecated and should not be used in newly-written code.

`e` : |
`limit` : |

### e_thread_set_msg_lost ()

    void                e_thread_set_msg_lost               (EThread *e,
                                                             EThreadFunc destroy,
                                                             void *data);

### Warning

`e_thread_set_msg_lost` is deprecated and should not be used in newly-written code.

`e` : |
`destroy` : |
`data` : |

### e_thread_set_msg_destroy ()

    void                e_thread_set_msg_destroy            (EThread *e,
                                                             EThreadFunc destroy,
                                                             void *data);

### Warning

`e_thread_set_msg_destroy` is deprecated and should not be used in newly-written code.

`e` : |
`destroy` : |
`data` : |

### e_thread_set_reply_port ()

    void                e_thread_set_reply_port             (EThread *e,
                                                             EMsgPort *reply_port);

### Warning

`e_thread_set_reply_port` is deprecated and should not be used in newly-written code.

`e` : |
`reply_port` : |

### e_thread_set_msg_received ()

    void                e_thread_set_msg_received           (EThread *e,
                                                             EThreadFunc received,
                                                             void *data);

### Warning

`e_thread_set_msg_received` is deprecated and should not be used in newly-written code.

`e` : |
`received` : |
`data` : |

### e_thread_put ()

    void                e_thread_put                        (EThread *e,
                                                             EMsg *msg);

### Warning

`e_thread_put` is deprecated and should not be used in newly-written code.

`e` : |
`msg` : |

### e_thread_busy ()

    int                 e_thread_busy                       (EThread *e);

### Warning

`e_thread_busy` is deprecated and should not be used in newly-written code.

`e` : |
Returns : |

### EMutex

    typedef struct _EMutex EMutex;

### Warning

`EMutex` is deprecated and should not be used in newly-written code.

### enum e_mutex_t

    typedef enum _e_mutex_t {
    	E_MUTEX_SIMPLE,		/* == pthread_mutex */
    	E_MUTEX_REC,		/* recursive mutex */
    } e_mutex_t;

### Warning

`e_mutex_t` is deprecated and should not be used in newly-written code.

### e_mutex_new ()

    EMutex*             e_mutex_new                         (e_mutex_t type);

### Warning

`e_mutex_new` is deprecated and should not be used in newly-written code.

`type` : |
Returns : |

### e_mutex_destroy ()

    int                 e_mutex_destroy                     (EMutex *m);

### Warning

`e_mutex_destroy` is deprecated and should not be used in newly-written code.

`m` : |
Returns : |

### e_mutex_lock ()

    int                 e_mutex_lock                        (EMutex *m);

### Warning

`e_mutex_lock` is deprecated and should not be used in newly-written code.

`m` : |
Returns : |

### e_mutex_unlock ()

    int                 e_mutex_unlock                      (EMutex *m);

### Warning

`e_mutex_unlock` is deprecated and should not be used in newly-written code.

`m` : |
Returns : |

### e_mutex_assert_locked ()

    void                e_mutex_assert_locked               (EMutex *m);

### Warning

`e_mutex_assert_locked` is deprecated and should not be used in newly-written code.

`m` : |

### e_mutex_cond_wait ()

    int                 e_mutex_cond_wait                   (void *cond,
                                                             EMutex *m);

### Warning

`e_mutex_cond_wait` is deprecated and should not be used in newly-written code.

`cond` : |
`m` : |
Returns : |