Update of /project/closure/cvsroot/closure/src/net In directory clnet:/tmp/cvs-serv11810/src/net
Modified Files: ftp.lisp http.lisp Log Message:
Use Bordeaux Threads for all threading primitives, so that non-GUI parts of Closure don't have to depend on CLIM anymore.
- Removed all mp/ functions from glisp.
- Use condition variables instead of process-wait.
--- /project/closure/cvsroot/closure/src/net/ftp.lisp 2005/03/13 18:02:19 1.2 +++ /project/closure/cvsroot/closure/src/net/ftp.lisp 2006/12/31 15:42:41 1.3 @@ -683,11 +683,11 @@ ||#
(defvar *connection-pool* nil) -(defvar *connection-pool-lock* (mp/make-lock :name "FTP connections pool lock")) +(defvar *connection-pool-lock* (bordeaux-threads:make-lock "FTP connections pool lock"))
(defmacro with-ftp-connection-pool (dummy &body body) dummy - `(mp/with-lock (*connection-pool-lock*) + `(bordeaux-threads:with-recursive-lock-held (*connection-pool-lock*) ,@body))
(defun put-ftp-connection-into-pool (connection) --- /project/closure/cvsroot/closure/src/net/http.lisp 2006/11/06 19:41:56 1.9 +++ /project/closure/cvsroot/closure/src/net/http.lisp 2006/12/31 15:42:41 1.10 @@ -414,7 +414,7 @@ (cond ((probe-file fn) (with-open-file (stream fn :direction :input) (let ((*package* (symbol-package 'http-cache-entry))) - (let ((res (make-http-cache :lock (mp/make-lock :name "HTTP cache lock") + (let ((res (make-http-cache :lock (bordeaux-threads:make-lock "HTTP cache lock") :directory directory :entries (make-hash-table :test #'equal)))) (setf (http-cache-serial res) (read stream)) @@ -424,13 +424,13 @@ (put-hce res x)) res)))) (t - (make-http-cache :lock (mp/make-lock :name "HTTP cache lock") + (make-http-cache :lock (bordeaux-threads:make-lock "HTTP cache lock") :directory directory :entries (make-hash-table :test #'equal) :serial 0)) )))
(defun commit-cache (&optional (cache (http-cache))) - (mp/with-lock ((http-cache-lock cache)) + (bordeaux-threads:with-recursive-lock-held ((http-cache-lock cache)) (with-open-file (sink (merge-pathnames "index" (http-cache-directory cache)) :direction :output :if-exists :new-version) (let ((*print-pretty* nil) @@ -443,15 +443,15 @@ (http-cache-entries cache)) ))) )
(defun invent-cache-filename (cache) - (mp/with-lock ((http-cache-lock cache)) + (bordeaux-threads:with-recursive-lock-held ((http-cache-lock cache)) (format nil "~5,'0D" (incf (http-cache-serial cache)))))
(defun get-hce (cache url) - (mp/with-lock ((http-cache-lock cache)) + (bordeaux-threads:with-recursive-lock-held ((http-cache-lock cache)) (gethash url (http-cache-entries cache))))
(defun put-hce (cache hce) - (mp/with-lock ((http-cache-lock cache)) + (bordeaux-threads:with-recursive-lock-held ((http-cache-lock cache)) ;; if there was already an entry for that URL with under a different filename, ;; delete the old file (let ((old-ce (gethash (hce-url hce) (http-cache-entries cache))))