-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmp-compat-lw6.lisp
More file actions
31 lines (24 loc) · 1021 Bytes
/
mp-compat-lw6.lisp
File metadata and controls
31 lines (24 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;; mp-compat-lw.lisp
;; --------------------------------------------------------------------------------------
;; Compatibility layer for Lispworks, Allegro, OS X, and Win32, Mulit-Processing Primitives
;;
;; Copyright (C) 2008 by SpectroDynamics, LLC. All rights reserved.
;;
;; DM/SD 08/08
;; --------------------------------------------------------------------------------------
;; --------------------------------------------------
(in-package #:mp-compatibility)
;; --------------------------------------------------
;; Compatibility Layer
;; ------------------------------------------------
;; Spin-locks
(defun do-with-spinlock (lock fn &aux ans)
(loop until (mp:with-lock (lock nil 0)
(setf ans (multiple-value-list (funcall fn)))
t))
(values-list ans))
(defmacro with-spinlock ((lock) &body body)
`(do-with-spinlock ,lock (lambda () ,@body)))
#|(defmacro xwith-spinlock ((lock) &body body)
`(mp:with-lock (,lock) ,@body))|#
(editor:setup-indent "with-spinlock" 1)