In process locking implemented, not sqlite locking.
This commit is contained in:
+22
-1
@@ -83,6 +83,18 @@ Returns all keys.
|
||||
|
||||
Returns all key-value pairs.
|
||||
}
|
||||
|
||||
@defmethod[(with-lock [proc (-> any/c)]) any/c]{
|
||||
|
||||
Calls @racket[proc] while holding the lock belonging to this keystore
|
||||
object and returns the value produced by @racket[proc]. Other threads
|
||||
using @method[keystore% with-lock] on the same object wait until the lock is
|
||||
released.
|
||||
|
||||
The lock is reentrant for nested calls on the same thread and is
|
||||
released when control leaves @racket[proc], including when an exception
|
||||
is raised. Keystore methods do not acquire this lock automatically.
|
||||
}
|
||||
}
|
||||
|
||||
@section{Examples}
|
||||
@@ -115,4 +127,13 @@ Returns all key-value pairs.
|
||||
@racketblock[
|
||||
(send ks glob "*b*")
|
||||
(send ks glob-kv "*b*")
|
||||
]
|
||||
]
|
||||
|
||||
@subsection{Locking}
|
||||
|
||||
@racketblock[
|
||||
(send ks with-lock
|
||||
(λ ()
|
||||
(send ks set! 'counter
|
||||
(add1 (send ks get 'counter 0)))))
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user