- class UnlockedDocumentProxy(doc: Document)#
Wrap a Document object so that only methods that can safely be used from unlocked callbacks or threads are exposed. Attempts to otherwise access or change the Document results in an exception.
- add_next_tick_callback(callback: Callback) NextTickCallback #
Add a “next tick” callback.
callback (callable) –
- without_document_lock(func: F) NoLockCallback[F] #
Wrap a callback function to execute without first obtaining the document lock.
func (callable) – The function to wrap
a function wrapped to execute without a
- Return type
While inside an unlocked callback, it is completely unsafe to modify
curdoc(). The value of
curdoc()inside the callback will be a specially wrapped version of
Documentthat only allows safe operations, which are:
Only these may be used safely without taking the document lock. To make other changes to the document, you must add a next tick callback and make your changes to
curdoc()from that second callback.
Attempts to otherwise access or change the Document will result in an exception being raised.
funccan be a synchronous function, an async function, or a function decorated with
asyncio.coroutine. The returned function will be an async function if
funcis any of the latter two.