About 9,880 results
Open links in new tab
  1. Python threading. How do I lock a thread? - Stack Overflow

    Oct 7, 2024 · I'm trying to understand the basics of threading and concurrency. I want a simple case where two threads repeatedly try to access one shared resource. The code: import …

  2. Python Multithreading Tutorial: Lock objects - acquire () and …

    Python Multithread Creating a thread and passing arguments to the thread Identifying threads - naming and logging Daemon thread & join () method Active threads & enumerate () method …

  3. Python Multithreading Tutorial: Using locks in the with statement ...

    finally: some_lock.release() Locks implement the context manager API and are compatible with the with statement. By using locks in the with statement, we do not need to explicitly acquire …

  4. What is the difference between Lock and RLock - Stack Overflow

    From the docs: threading.RLock() -- A factory function that returns a new reentrant lock object. A reentrant lock must be released by the thread that acquired it. Once a thread has acquired a

  5. When and how to use Python's RLock - Stack Overflow

    Lock = _allocate_lock # line 98 threading.py def RLock(*args, **kwargs): return _RLock(*args, **kwargs) class _RLock(_Verbose): def __init__(self, verbose=None): _Verbose.__init__(self, …

  6. Python Conditional "With" Lock Design - Stack Overflow

    Since this is the first result in Google about " using threading.Lock () with with / context_manager " here is the answer: yes, you can use both Lock, RLock, or any other object in python threading …

  7. multithreading - Understanding multi-threading and locks in …

    May 26, 2022 · @tdelaney Although it may be less serious in Python than in C, because (I believe) Python implements threading in the interpreter, and its granuarity is the statement or …

  8. python - How to use threading.Lock in async function while object …

    Aug 15, 2020 · The rest of this answer will assume that you have a threading.Lock shared between threads. Since threading.Lock always blocks, the only way you can use it from …

  9. Does python threading.Lock() lock everything that needs locking?

    Dec 6, 2018 · Script below is abstracted. My question is about the use of threading.Lock() Locking limits access to "shared resources" but I am nervous about how far that goes. I have objects …

  10. Query whether Python's threading.Lock is locked or not

    Oct 19, 2013 · Query whether Python's threading.Lock is locked or not Asked 12 years, 1 month ago Modified 6 years, 6 months ago Viewed 38k times