(sb!xc:defmacro with-spinlock ((lock) &body body)
(deprecation-warning :early "1.0.53.11" 'with-recursive-spinlock 'with-mutex)
- `(with-lock (,lock)
+ `(with-mutex (,lock)
,@body))
(sb!xc:defmacro without-thread-waiting-for ((&key already-without-interrupts) &body body)
(let ((res (list (sb-thread:join-thread t1)
(sb-thread:join-thread t2))))
(assert (equal '(:ok :ok) res)))))
+
+(with-test (:name :spinlock-api)
+ (let* ((warned 0)
+ (funs
+ (handler-bind ((sb-int:early-deprecation-warning (lambda (_)
+ (declare (ignore _))
+ (incf warned))))
+ (list (compile nil `(lambda (lock)
+ (sb-thread::with-spinlock (lock)
+ t)))
+ (compile nil `(lambda ()
+ (sb-thread::make-spinlock :name "foo")))
+ (compile nil `(lambda (lock)
+ (sb-thread::get-spinlock lock)))
+ (compile nil `(lambda (lock)
+ (sb-thread::release-spinlock lock)))))))
+ (assert (eql 4 warned))
+ (handler-bind ((warning #'error))
+ (destructuring-bind (with make get release) funs
+ (let ((lock (funcall make)))
+ (funcall get lock)
+ (funcall release lock)
+ (assert (eq t (funcall with lock))))))))