Skip to main content

All Questions

0 votes
1 answer
72 views

How to ask for userinput and do something else at the same time

I am trying to make a simple command line irc client. I basically want to receive and send messages. The problem is that in the code below the program waits until some input is given, as expected. So ...
sabrov's user avatar
  • 1
1 vote
1 answer
57 views

Threading in python is not running concurrently [duplicate]

from time import sleep import threading def sleep_and_print(duration, name): sleep(duration) print(name) t1 = threading.Thread(target=sleep_and_print(2, "three second sleep")) t2 = ...
GC30's user avatar
  • 45
0 votes
1 answer
449 views

Attempting to run threads concurrently inside while loop in Python 3.11

I am trying to get my head around threading in Python 3.11 and I am trying to work out why when I put a time.sleep(120) inside execute_subtasks that the next thread is not processed and the code ...
crmpicco's user avatar
  • 17.3k
0 votes
1 answer
142 views

How to run threads with django

How to run thread with Django how to send data inside views file from django.shortcuts import render from django.http.response import HttpResponse from datetime import datetime from .pnet import ...
Ufuk Sipor's user avatar
0 votes
1 answer
606 views

Python, ThreadPoolExecutor, pool execution doesnt terminate

I have got I simple code modelling a more complicated problem I am to solve. Here I have 3 funcs- worker, task submitter (seek tasks and put it to queue once it gets new ones) and function creating ...
user avatar
0 votes
3 answers
178 views

How to run multiple threads together in simpler code in Python?

I'm trying to simplify the code of threads below: import threading def test1(): print("test1") def test2(): print('test2') thread1 = threading.Thread(target=test1) thread2 = ...
Super Kai - Kazuya Ito's user avatar
0 votes
3 answers
325 views

Unexpected behavior of Threading.join() - Code between calls to Threading.join()

Does the order of the Threading.join()s in the source code GUARANTEE the order of execution of the threads OR IS IT SIMPLY to ensure that the main thread finishes UNTIL ALL THREADS FINISH? import ...
user avatar
0 votes
1 answer
759 views

Execute threads in certain order

When we launch threads, is it known for SURE which thread will be executed first or is it something not predictable ? I say this because square is always called first and then cube. import threading ...
user avatar
0 votes
1 answer
2k views

Why does a result() from concurrent.futures.as_completed() occasionally return None?

I've been writing a fairly complex series of modules to help test our poorly documented networking gear, this one focused on trying the various passwords used across the company. I've been using the ...
claccx's user avatar
  • 13
0 votes
1 answer
77 views

how can deadlock occur if locks guarantee atomicity

Situation 1: //snippet1 a=1 if(a!=0){ print(a); } //snippet2 a=0; lets say thread T1 is executing snippet1, checks the if condition (which is true),enters the scope of if, then T1 is interrupted, and ...
Vinay Shukla's user avatar
1 vote
0 answers
220 views

Nested threadpool with different worker count

I've started learning Python and came across a scenario where I have to implement two separate queues: I have N processes and two operations, O1 and O2. I want to run O1 with 4 workers. And O2 with 1 ...
wefwe's user avatar
  • 11
1 vote
2 answers
190 views

Python multi threads synchronization

I created several threads to run the same function with different arguments concurrently. I want each thread to be blocked until a delay passed from the run of the last thread. I use threading.Queue ...
MatinMoezi's user avatar
1 vote
1 answer
964 views

Terminate executor using ThreadPoolExecutor from concurrent.futures module

I am trying to terminate a ThreadPool based on values returned from long running request. I wish to terminate the ThreadPool once the sum of the request return values reaches MIN_REQUIRED_VALUE I am ...
Pierre's user avatar
  • 508
0 votes
0 answers
151 views

How to make sure concurrent.futures.ThreadPoolExecutor stores data in the correct order?

I have a dataframe that consists of all the links that I will use requests to scrape the data. I am using concurrent.futures.ThreadPoolExecutor to loop through all the links from the dataframe and ...
Goh Kok Han's user avatar
0 votes
1 answer
86 views

'threading' library in Python | Concurrency or Parallelism?

I'm a noob at using threading library. I have been implementing from threading import Thread in conjunction with unittest and hypothesis libraries for test cases. Concurrency vs. Parallelism is ...
user avatar

15 30 50 per page