From dd8365ec4c8276743294b1ec2740b61c6a7793ef Mon Sep 17 00:00:00 2001 From: "Pierre R. Mai" Date: Mon, 9 Oct 2000 21:55:43 +0000 Subject: [PATCH] Factored locking primitives out to their own implementation-dependend files. Part of the porting effort to LispWorks. --- src/cmu-locking.cl | 28 ++++++++++++++++++++++++++++ src/lwl-locking.cl | 24 ++++++++++++++++++++++++ src/main/buffer.cl | 11 ++--------- 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 src/cmu-locking.cl create mode 100644 src/lwl-locking.cl diff --git a/src/cmu-locking.cl b/src/cmu-locking.cl new file mode 100644 index 0000000..4e19ab2 --- /dev/null +++ b/src/cmu-locking.cl @@ -0,0 +1,28 @@ +;;;; CLASH --- The Common Lisp Adaptable Simple HTTP server +;;;; This is copyrighted software. See documentation for terms. +;;;; +;;;; cmu-locking.cl --- Platform independent locking primitives +;;;; +;;;; Checkout Tag: $Name$ +;;;; $Id$ + +(in-package :CLASH) + +;;;; %File Description: +;;;; +;;;; +;;;; + +;;; Locking primitives for CMUCL + +(defmacro pop-atomically (place) + #+MP + `(mp:atomic-pop ,place) + #-MP + `(pop ,place)) + +(defmacro push-atomically (value place) + #+MP + `(mp:atomic-push ,value ,place) + #-MP + `(push ,value ,place)) diff --git a/src/lwl-locking.cl b/src/lwl-locking.cl new file mode 100644 index 0000000..4b370cd --- /dev/null +++ b/src/lwl-locking.cl @@ -0,0 +1,24 @@ +;;;; CLASH --- The Common Lisp Adaptable Simple HTTP server +;;;; This is copyrighted software. See documentation for terms. +;;;; +;;;; lwl-locking.cl --- Platform independent locking primitives +;;;; +;;;; Checkout Tag: $Name$ +;;;; $Id$ + +(in-package :CLASH) + +;;;; %File Description: +;;;; +;;;; +;;;; + +;;; Locking primitives for LWL + +(defmacro pop-atomically (place) + `(mp:without-preemption + (pop ,place))) + +(defmacro push-atomically (value place) + `(mp:without-preemption + (push ,value ,place))) diff --git a/src/main/buffer.cl b/src/main/buffer.cl index 475b76f..5f84d86 100644 --- a/src/main/buffer.cl +++ b/src/main/buffer.cl @@ -29,21 +29,14 @@ server needs.") with `release-io-buffer', to enable it to be recycled. Otherwise it will just be GC'ed as usual." (or - #+(and :CMU :MP) - (mp:atomic-pop *io-buffers*) - #-(and :CMU :MP) - (pop *io-buffers*) - + (pop-atomically *io-buffers*) ;; No ready-made buffer, so we create a new one (make-new-buffer))) (defun release-io-buffer (buffer) "Return a buffer allocated by `get-io-buffer' to the buffer pool for re-use." - #+(and :CMU :MP) - (mp:atomic-push buffer *io-buffers*) - #-(and :CMU :MP) - (push buffer *io-buffers*) + (push-atomically buffer *io-buffers*) t) (defmacro with-io-buffer ((var) &body body)