14 typedef struct ListNode ListNode;
18 ListNode *prev, *next;
23 ListNode *first, *last;
26 pthread_mutex_t mutex;
32 // Creates an empty list
33 List* createEmptyList (void);
35 // Destroys a list, and eventually frees the elements
37 void destroyList (List *l, void (*freefunc)(void*));
39 // Adds an element at front of the list
40 void pushFrontList (List *l, void* data);
42 // Adds an element at back of the list
43 void pushBackList (List *l, void* data);
45 // Pops an element from the front of the list and returns its value
46 void* popFrontList (List *l);
48 // Pops an element from the back of the list and returns its value
49 void* popBackList (List *l);
51 // Clears all the items of the list, and eventually frees them
52 void clearList (List *l, void (*freefunc)(void*));
54 // Find and destroy a particular element of the list, and eventually frees it
55 bool findAndDestroy (List *l, void* data, void (*freefunc)(void*));
57 // Browse all the items of the list through the callback function
58 void browseList (List *l, void (*browsefunc)(void*));
61 void* convertToArray (List *l, size_t sz);