- (multiple-value-bind (user-data exists-p) (gethash id *user-data*)
- (cond
- ((not exists-p) (error "User data id ~A does not exist" id))
- (t
- (when (cdr user-data)
- (funcall (cdr user-data) (car user-data)))
- (setf (car user-data) object)))))
+ (with-mutex (*user-data-lock*)
+ (multiple-value-bind (user-data exists-p) (gethash id *user-data*)
+ (cond
+ ((not exists-p) (error "User data id ~A does not exist" id))
+ (t
+ (when (cdr user-data)
+ (funcall (cdr user-data) (car user-data)))
+ (setf (car user-data) object))))))