I'm not all that familiar with Clozure CL's locking mechanisms, but I think that some macroexpansion can illustrate at least one way to do this:
CL-USER> (pprint (macroexpand-1 '(with-write-lock (my-lock)
do-something)))
(CCL::WITH-LOCK-CONTEXT
(LET* ((#:G350 (MAKE-LOCK-ACQUISITION))
(#:G351 MY-LOCK))
(DECLARE (DYNAMIC-EXTENT #:G350))
(UNWIND-PROTECT
(PROGN
(CCL::WRITE-LOCK-RWLOCK #:G351 #:G350)
DO-SOMETHING)
(WHEN (CCL::LOCK-ACQUISITION.STATUS #:G350)
(CCL::UNLOCK-RWLOCK #:G351)))))
I can't say whether this (using ccl::with-lock-context/ccl::write-lock-rwlock
) is a good way to do this in your own code or not, but it's certainly a way to do it.