diff --git a/gc-notes.txt b/gc-notes.txt index 6a96ca5d..6649d245 100644 --- a/gc-notes.txt +++ b/gc-notes.txt @@ -15,6 +15,9 @@ TODO: - add mutex type, and associated functions from SRFI-18 when allocating a mutex, probably should do it on thread since by definition these are shared among multiple threads + - may be able to free mutex using mutex_destroy from within gc_sweep. + unfortunately it requires type checking each object before free, which is not ideal + - start making core stuff thread safe. for example, test.scm sometimes crashes, I think printing out result from (read) - assume I/O and eval both have threading issues diff --git a/include/cyclone/types.h b/include/cyclone/types.h index edadf27f..66ba61b0 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -206,6 +206,7 @@ typedef long tag_type; #define cvar_tag 16 #define vector_tag 17 #define macro_tag 18 +#define mutex_tag 19 #define nil NULL #define eq(x,y) (x == y) @@ -238,6 +239,11 @@ typedef struct {gc_header_type hdr; tag_type tag; object *pvar;} cvar_type; typedef cvar_type *cvar; #define make_cvar(n,v) cvar_type n; n.hdr.mark = gc_color_red; n.hdr.grayed = 0; n.tag = cvar_tag; n.pvar = v; +// TODO: mutex type +// thinking about maybe using cvar_type with a mutex tag +// add an alloc_mutex macro/function, because these will only go on the heap + + /* Define boolean type. */ typedef struct {gc_header_type hdr; const tag_type tag; const char *pname;} boolean_type; typedef boolean_type *boolean;