-(in-package #:clsql-base-sys)
-
-(defun make-process-lock (name)
- #+allegro (mp:make-process-lock :name name)
- #+cmu (mp:make-lock name)
- #+lispworks (mp:make-lock :name name)
- #+openmcl (ccl:make-lock :name name)
- #+sb-thread (sb-thread:make-mutex :name name)
- #+scl (thread:make-lock name)
- #-(or allegro cmu lispworks openmcl sb-thread scl) (declare (ignore name))
- #-(or allegro cmu lispworks openmcl sb-thread scl) nil)
-
-(defmacro with-process-lock ((lock desc) &body body)
- #+(or cmu allegro lispworks openmcl sb-thread)
- (declare (ignore desc))
- #+(or allegro cmu lispworks openmcl sb-thread)
- (let ((l (gensym)))
- `(let ((,l ,lock))
- #+allegro (mp:with-process-lock (,l) ,@body)
- #+cmu (mp:with-lock-held (,l) ,@body)
- #+openmcl (ccl:with-lock-grabbed (,l) ,@body)
- #+lispworks (mp:with-lock (,l) ,@body)
- #+sb-thread (sb-thread:with-recursive-lock (,l) ,@body)
- ))
-
- #+scl `(thread:with-lock-held (,lock ,desc) ,@body)
-
- #-(or cmu allegro lispworks openmcl sb-thread scl) (declare (ignore lock desc))
- #-(or cmu allegro lispworks openmcl sb-thread scl) `(progn ,@body))