From cludwig at common-lisp.net Mon Dec 8 18:39:05 2008 From: cludwig at common-lisp.net (Christoph Ludwig) Date: Mon, 08 Dec 2008 18:39:05 +0000 Subject: [isidorus-cvs] r1 - branches tags trunk Message-ID: Author: cludwig Date: Mon Dec 8 18:39:05 2008 New Revision: 1 Log: initial set-up of repo structure Added: branches/ tags/ trunk/ From cludwig at common-lisp.net Mon Dec 8 18:47:37 2008 From: cludwig at common-lisp.net (Christoph Ludwig) Date: Mon, 08 Dec 2008 18:47:37 +0000 Subject: [isidorus-cvs] r3 - trunk/trunk/src/xml/data_base Message-ID: Author: cludwig Date: Mon Dec 8 18:47:37 2008 New Revision: 3 Log: don't keep databases in the repo that are leftovers from unit-tests Removed: trunk/trunk/src/xml/data_base/ From cludwig at common-lisp.net Fri Dec 12 12:10:03 2008 From: cludwig at common-lisp.net (Christoph Ludwig) Date: Fri, 12 Dec 2008 12:10:03 +0000 Subject: [isidorus-cvs] r4 - in trunk/trunk/src: . atom external json model rest_interface threading unit_tests xml Message-ID: Author: cludwig Date: Fri Dec 12 12:10:03 2008 New Revision: 4 Log: preparations for the integration of reader-writer locks Added: trunk/trunk/src/threading/ (props changed) trunk/trunk/src/threading/reader-writer.lisp (contents, props changed) Modified: trunk/trunk/src/ (props changed) trunk/trunk/src/atom/ (props changed) trunk/trunk/src/external/ (props changed) trunk/trunk/src/isidorus.asd trunk/trunk/src/json/ (props changed) trunk/trunk/src/model/ (props changed) trunk/trunk/src/rest_interface/ (props changed) trunk/trunk/src/unit_tests/ (props changed) trunk/trunk/src/xml/ (props changed) Modified: trunk/trunk/src/isidorus.asd ============================================================================== --- trunk/trunk/src/isidorus.asd (original) +++ trunk/trunk/src/isidorus.asd Fri Dec 12 12:10:03 2008 @@ -113,7 +113,9 @@ "json")) (:module "json" :components ((:file "json_exporter")) - :depends-on ("model"))) + :depends-on ("model")) + (:module "threading" + :components ((:file "reader-writer")))) :depends-on (:cxml :drakma :elephant Added: trunk/trunk/src/threading/reader-writer.lisp ============================================================================== --- (empty file) +++ trunk/trunk/src/threading/reader-writer.lisp Fri Dec 12 12:10:03 2008 @@ -0,0 +1,56 @@ +(defpackage :isidorus-reader-writer + (:use :cl :hunchentoot-mp) + (:export :current-readers + :with-reader-lock + :with-writer-lock)) + +(in-package :isidorus-reader-writer) + +(defvar *readerlist-mutex* (make-lock "isidorus current-readers lock")) +(defvar *writer-mutex* (make-lock "isidorus writer lock")) + +(defvar *current-readers* nil) + +(defun current-readers () + (let + ((result nil)) + (with-lock (*readerlist-mutex*) + (setf result (copy-list *current-readers*))) + result)) + +(defun add-current-to-reader-list () + (with-lock (*writer-mutex*) + (with-lock (*readerlist-mutex*) + (push *current-process* *current-readers*)))) + +(defun remove-current-from-reader-list () + (with-lock (*readerlist-mutex*) + (setf *current-readers* + (delete *current-process* *current-readers*)))) + +(defmacro with-reader-lock (&body body) + `(progn + (add-current-to-reader-list) + (handler-case + (progn , at body) + (condition (c) + (progn + (remove-current-from-reader-list) + (error c)))) + (remove-current-from-reader-list))) + + +(defmacro with-writer-lock (&body body) + `(with-lock (*writer-mutex*) + (do + ((remaining-readers (current-readers) (current-readers))) + ((nullp remaining-raeders) nil) + ;; TODO: replace hunchentoot's internal function by + ;; something we are officially allowed to use. + ;; make sure the current thread sleeps for, say, 500ms. + (hunchentoot::process-allow-scheduling())) + , at body)) + + + + \ No newline at end of file From cludwig at common-lisp.net Fri Dec 12 16:40:31 2008 From: cludwig at common-lisp.net (Christoph Ludwig) Date: Fri, 12 Dec 2008 16:40:31 +0000 Subject: [isidorus-cvs] r5 - in trunk: branches docs src tags trunk Message-ID: Author: cludwig Date: Fri Dec 12 16:40:30 2008 New Revision: 5 Log: fix the duplicate trunk/tags/branches layer Added: trunk/docs/ (props changed) - copied from r4, /trunk/trunk/docs/ trunk/src/ (props changed) - copied from r4, /trunk/trunk/src/ Removed: trunk/branches/ trunk/tags/ trunk/trunk/