klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit a1f42c7a067ce33801360f7766e002929a120f51
parent 1aa0401c3e53c8e3ddaec8133f4d9b505b95812d
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 24 Aug 2012 02:30:52 -0300

Added locking to kapplicative functions.

Diffstat:
Msrc/kapplicative.c | 2++
Msrc/kgsystem.c | 1+
Msrc/kmem.c | 1-
Msrc/kstate.c | 3++-
4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/kapplicative.c b/src/kapplicative.c @@ -13,6 +13,7 @@ /* GC: Assumes underlying is rooted */ TValue kwrap(klisp_State *K, TValue underlying) { + klisp_lock(K); Applicative *new_app = klispM_new(K, Applicative); /* header + gc_fields */ @@ -21,5 +22,6 @@ TValue kwrap(klisp_State *K, TValue underlying) /* applicative specific fields */ new_app->underlying = underlying; + klisp_unlock(K); return gc2app(new_app); } diff --git a/src/kgsystem.c b/src/kgsystem.c @@ -104,6 +104,7 @@ void delete_file(klisp_State *K) /* TEMP: this should probably be done in a operating system specific manner, but this will do for now */ if (remove(kstring_buf(filename))) { + /* XXX lock? */ /* At least in Windows, this could have failed if there's a dead (in the gc sense) port still open, should retry once after doing a complete GC. This isn't ideal but... */ diff --git a/src/kmem.c b/src/kmem.c @@ -75,7 +75,6 @@ void *klispM_realloc_ (klisp_State *K, void *block, size_t osize, size_t nsize) /* TEMP: for now only Stop the world GC */ /* TEMP: prevent recursive call of klispC_fullgc() */ - klisp_lock(K); #ifdef KUSE_GC if (nsize > 0 && G(K)->totalbytes - osize + nsize >= G(K)->GCthreshold) { diff --git a/src/kstate.c b/src/kstate.c @@ -151,7 +151,7 @@ static void preinit_state (klisp_State *K, global_State *g) { static void close_state(klisp_State *K) { global_State *g = G(K); - +/* XXX lock? */ /* collect all objects */ klispC_freeall(K); klisp_assert(g->rootgc == obj2gco(K)); @@ -431,6 +431,7 @@ void klispT_freethread (klisp_State *K, klisp_State *K1) void klisp_close (klisp_State *K) { +/* XXX lock? */ K = G(K)->mainthread; /* only the main thread can be closed */ /* XXX lua does the following */