klisp

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

commit ee89b4aace41c4346f75824034ab9ea65e9498b7
parent c541926ecdac553369fcd200c32cd04f806ab9e0
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 24 Aug 2012 02:43:03 -0300

Added locking to kencapsulation.

Diffstat:
Msrc/kbytevector.h | 1+
Msrc/kencapsulation.c | 2++
Msrc/kencapsulation.h | 1+
3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/kbytevector.h b/src/kbytevector.h @@ -44,6 +44,7 @@ bool kimmutable_bytevectorp(TValue obj); bool kmutable_bytevectorp(TValue obj); /* some macros to access the parts of the bytevectors */ +/* LOCK: these are immutable, so they don't need locking */ #define kbytevector_buf(tv_) (tv2bytevector(tv_)->b) #define kbytevector_size(tv_) (tv2bytevector(tv_)->size) diff --git a/src/kencapsulation.c b/src/kencapsulation.c @@ -19,6 +19,7 @@ bool kis_encapsulation_type(TValue enc, TValue key) /* GC: Assumes that key & val are rooted */ TValue kmake_encapsulation(klisp_State *K, TValue key, TValue val) { + klisp_lock(K); Encapsulation *new_enc = klispM_new(K, Encapsulation); /* header + gc_fields */ @@ -28,6 +29,7 @@ TValue kmake_encapsulation(klisp_State *K, TValue key, TValue val) new_enc->key = key; new_enc->value = val; + klisp_unlock(K); return gc2enc(new_enc); } diff --git a/src/kencapsulation.h b/src/kencapsulation.h @@ -16,6 +16,7 @@ TValue kmake_encapsulation(klisp_State *K, TValue key, TValue val); TValue kmake_encapsulation_key(klisp_State *K); bool kis_encapsulation_type(TValue enc, TValue key); +/* LOCK: these are immutable, so they don't need locking */ #define kget_enc_val(e_)(tv2enc(e_)->value) #define kget_enc_key(e_)(tv2enc(e_)->key)