About 72,600 results
Open links in new tab
  1. How do I use threading in Python? - Stack Overflow

    Jun 21, 2019 · You can run it and understand easily how multi threading is working in Python. I used a lock for preventing access to other threads until the previous threads finished their work.

  2. python - multiprocessing vs multithreading vs asyncio - Stack Overflow

    Dec 12, 2014 · So if your task is I/O bound - use threading. asyncio is essentially threading where not the CPU but you, as a programmer (or actually your application), decide where and when does the …

  3. How do threads work in Python, and what are common Python …

    Jun 26, 2013 · Use threads in python if the individual workers are doing I/O bound operations. If you are trying to scale across multiple cores on a machine either find a good IPC framework for python or …

  4. python - What is the use of join () in threading? - Stack Overflow

    Jul 20, 2023 · In python 3.x join () is used to join a thread with the main thread i.e. when join () is used for a particular thread the main thread will stop executing until the execution of joined thread is …

  5. python - When to use threading and how many threads to use - Stack …

    May 3, 2017 · I'm a fairly new python programmer and decided to take a whack at it. While learning and implementing the threading, I had the question similar to How many threads is too many? because …

  6. How to Multi-thread an Operation Within a Loop in Python

    Sep 6, 2019 · 194 First, in Python, if your code is CPU-bound, multithreading won't help, because only one thread can hold the Global Interpreter Lock, and therefore run Python code, at a time. So, you …

  7. Multiprocessing vs Threading Python - Stack Overflow

    Apr 29, 2019 · Python documentation quotes The canonical version of this answer is now at the dupliquee question: What are the differences between the threading and multiprocessing modules? …

  8. multithreading - Creating Threads in python - Stack Overflow

    May 9, 2019 · Here I show how to use the threading module to create a thread which invokes a normal function as its target. You can see how I can pass whatever arguments I need to it in the thread …

  9. How to get the return value from a thread? - Stack Overflow

    Mar 18, 2023 · In Python 3.2+, stdlib module provides a higher level API to , including passing return values or exceptions from a worker thread back to the main thread. You can call the on a instance, …

  10. python - How to use threading.Lock in async function while object can ...

    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 asyncio is to wait to …