16 typedef struct ListNode ListNode;
20 ListNode *prev, *next;
25 ListNode *first, *last;
29 pthread_mutex_t mutex;
36 // Creates an empty list
37 List* createEmptyList (void);
39 // Destroys a list, and eventually frees the elements
41 void destroyList (List *l, void (*freefunc)(void*));
43 // Adds an element at front of the list
44 void pushFrontList (List *l, void* data);
46 // Adds an element at back of the list
47 void pushBackList (List *l, void* data);
49 // Pops an element from the front of the list and returns its value
50 void* popFrontList (List *l);
52 // Pops an element from the back of the list and returns its value
53 void* popBackList (List *l);
55 // Clears all the items of the list, and eventually frees them
56 void clearList (List *l, void (*freefunc)(void*));
59 bool destroyElement (List *l, ListNode *ln, void (*freefunc)(void*));
61 // Find and destroy a particular element of the list, and eventually frees it
62 bool findAndDestroy (List *l, void* data, void (*freefunc)(void*));
64 // Browse all the items of the list through the callback function
65 void browseList (List *l, void (*browsefunc)(void*));
68 void* convertToArray (List *l, size_t sz);