Skip to content

Instantly share code, notes, and snippets.

@llibra
Created October 30, 2011 06:52
Show Gist options
  • Save llibra/1325606 to your computer and use it in GitHub Desktop.
Save llibra/1325606 to your computer and use it in GitHub Desktop.
A patch for paserve with CCL
diff -Nur -x '*~' -x '#*#' portableaserve-20110730-cvs/acl-compat/mcl/acl-mp.lisp portableaserve-20110730-cvs.mod/acl-compat/mcl/acl-mp.lisp
--- portableaserve-20110730-cvs/acl-compat/mcl/acl-mp.lisp 2011-10-30 15:28:17.484375000 +0900
+++ portableaserve-20110730-cvs.mod/acl-compat/mcl/acl-mp.lisp 2011-10-30 15:22:06.296875000 +0900
@@ -181,3 +181,24 @@
(process-wait-with-timeout (or whostate "Waiting for input") timeout #'collect-fds)
(process-wait (or whostate "Waiting for input") #'collect-fds)))
collected-fds))
+
+#+openmcl-native-threads
+(defvar *atomic-lock* (ccl:make-lock))
+
+#-openmcl-native-threads
+(defmacro atomic-incf (place)
+ `(incf ,place))
+
+#+openmcl-native-threads
+(defmacro atomic-incf (place)
+ `(ccl:with-lock-grabbed (*atomic-lock*)
+ (incf ,place)))
+
+#-openmcl-native-threads
+(defmacro atomic-decf (place)
+ `(decf ,place))
+
+#+openmcl-native-threads
+(defmacro atomic-decf (place)
+ `(ccl:with-lock-grabbed (*atomic-lock*)
+ (decf ,place)))
diff -Nur -x '*~' -x '#*#' portableaserve-20110730-cvs/acl-compat/mcl/acl-socket-openmcl.lisp portableaserve-20110730-cvs.mod/acl-compat/mcl/acl-socket-openmcl.lisp
--- portableaserve-20110730-cvs/acl-compat/mcl/acl-socket-openmcl.lisp 2011-10-30 15:48:13.125000000 +0900
+++ portableaserve-20110730-cvs.mod/acl-compat/mcl/acl-socket-openmcl.lisp 2011-10-30 13:50:13.828125000 +0900
@@ -8,7 +8,7 @@
(eval-when (:compile-toplevel :load-toplevel :execute)
(shadowing-import
'(;ccl:make-socket ; use our own version
- ccl:accept-connection
+ ;ccl:accept-connection
ccl:dotted-to-ipaddr
ccl:ipaddr-to-hostname
ccl:lookup-hostname
@@ -20,7 +20,7 @@
(eval-when (:compile-toplevel :load-toplevel :execute)
(export
- '(accept-connection
+ '(;accept-connection
ipaddr-to-dotted
dotted-to-ipaddr
ipaddr-to-hostname
@@ -49,7 +49,7 @@
(defmethod accept-connection ((server-socket server-socket)
&key (wait t))
"Return a bidirectional stream connected to socket."
- (let ((stream (accept-connection (socket server-socket) :wait wait)))
+ (let ((stream (ccl:accept-connection (socket server-socket) :wait wait)))
(when stream (make-chunked-stream stream))))
diff -Nur -x '*~' -x '#*#' portableaserve-20110730-cvs/aserve/main.cl portableaserve-20110730-cvs.mod/aserve/main.cl
--- portableaserve-20110730-cvs/aserve/main.cl 2011-10-30 15:28:16.328125000 +0900
+++ portableaserve-20110730-cvs.mod/aserve/main.cl 2011-10-30 15:24:38.515625000 +0900
@@ -586,17 +586,13 @@
(defmacro atomic-incf (var)
- #+openmcl-native-threads
- `(ccl::atomic-incf ,var)
- #+sbcl
+ #+(or openmcl-native-threads sbcl)
`(acl-compat.mp::atomic-incf ,var)
#-(or openmcl-native-threads sbcl)
`(acl-compat.mp:without-scheduling (incf ,var)))
(defmacro atomic-decf (var)
- #+openmcl-native-threads
- `(ccl::atomic-decf ,var)
- #+sbcl
+ #+(or openmcl-native-threads sbcl)
`(acl-compat.mp::atomic-decf ,var)
#-(or openmcl-native-threads sbcl)
`(acl-compat.mp:without-scheduling (decf ,var)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment