diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-10-01 20:16:28 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-10-01 20:16:28 +0000 |
commit | 7d83e5c7816b5e343695a75ba58b32dbe1be969a (patch) | |
tree | bfd1dfc9b7c8f4a2aaf66c1b30e78355dee8c88a /asyncq.h | |
parent | 762196328ab7e60f1d2908fd5a337d2ca99726dd (diff) |
move all sources down to a seperate src/ tree
git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@34 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce
Diffstat (limited to 'asyncq.h')
-rw-r--r-- | asyncq.h | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/asyncq.h b/asyncq.h deleted file mode 100644 index 2e60c23..0000000 --- a/asyncq.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef foosydneyhasynchfoo -#define foosydneyhasynchfoo - -#include "llist.h" -#include "mutex.h" - -typedef struct sa_asyncq sa_asyncq_t; -typedef struct sa_asyncq_item sa_asyncq_item_t; - -struct sa_asyncq_item { - SA_LLIST_ITEM(sa_asyncq_item_t, items); -}; - -#define SA_ASYNCQ_ITEM_DATA(x) ((void*) ((uint8_t*) (x) + ALIGN(sizeof(sa_asyncq_item_t)))) - -struct sa_asyncq { - sa_mutex_t *mutex; - - SA_LLIST_HEAD(sa_asyncq_item_t, items); - SA_LLIST_HEAD(sa_asyncq_item_t, unused); - - sa_asyncq_item_t *last; - - size_t item_size; -}; - -/* Implements a simple asynchronous queue for - * inter-thread-communication. To reading side can act in a wait-free - * fashion (though not lock-free). Should only be used together with a - * non-sychrnoized backing buffer such as sa_bufferq. */ - -int sa_asyncq_init(sa_asyncq_t *a, size_t item_size); - -void sa_asyncq_done(sa_asyncq_t *a); - -/* Allocate a free queue item */ -sa_asyncq_item_t *sa_asyncq_get(sa_asyncq_t *a); - -/* Give the queue item back to the queue */ -void sa_asyncq_recycle(sa_asyncq_t *a); - -/* Push a previously allocated entry into the queue */ -void sa_asyncq_push(sa_asyncq_t *a, sa_asyncq_item_t *i); - -/* Pop an entry from the queue */ -sa_asyncq_item_t* sa_asyncq_pop(sa_asyncq_t *a, int wait); - - -#endif |