The locking module

Manages locking access (across threads) to any object.

Use it for example to lock access to Poppler.Document instances.

lock(item)[source]

Return a threading.RLock instance for the given item.

Use:

with lock(document):

do_something