* src/toolbox/list.c (list_free): New function.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Thu, 13 Sep 2007 21:55:42 +0000 (23:55 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Thu, 13 Sep 2007 21:55:42 +0000 (23:55 +0200)
(list_lock): Likewise.
(list_unlock): Likewise.
* src/toolbox/list.h: Likewise.

src/toolbox/list.c
src/toolbox/list.h

index 720621e55b0e3823c53de29669e5bbe90fa97382..3f35eb4a48bd7165983dab8a15630b4a5620d801 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "config.h"
 
+#include <assert.h>
 #include <stdlib.h>
 
 #include "vm/types.h"
@@ -61,6 +62,20 @@ list_t *list_create(s4 nodeoffset)
 }
 
 
+/* list_free *******************************************************************
+
+   Free a list.
+
+*******************************************************************************/
+
+void list_free(list_t *l)
+{
+       assert(l != NULL);
+
+       FREE(l, list_t);
+}
+
+
 /* list_create_dump ************************************************************
 
    Allocates a new list on the dump memory.
@@ -84,6 +99,30 @@ list_t *list_create_dump(s4 nodeoffset)
 }
 
 
+/* list_lock *******************************************************************
+
+   Locks the list.
+
+*******************************************************************************/
+
+void list_lock(list_t *l)
+{
+       LOCK_MONITOR_ENTER(l);
+}
+
+
+/* list_unlock *****************************************************************
+
+   Unlocks the list.
+
+*******************************************************************************/
+
+void list_unlock(list_t *l)
+{
+       LOCK_MONITOR_EXIT(l);
+}
+
+
 /* list_add_first **************************************************************
 
    Adds the element as first element.
index f84f5e39806621f3beb446ae14408164f6d9f121..31cb0b3e7546a0680042a8784dd73493696f990c 100644 (file)
@@ -120,6 +120,10 @@ struct list_t {
 
 list_t *list_create(s4 nodeoffset);
 list_t *list_create_dump(s4 nodeoffset);
+void    list_free(list_t *l);
+
+void    list_lock(list_t *l);
+void    list_unlock(list_t *l);
 
 void    list_add_first(list_t *l, void *element);
 void    list_add_first_unsynced(list_t *l, void *element);