Linked Questions
98 questions linked to/from How to get the return value from a thread?
4 votes
2 answers
16k views
Python multiprocessing - return values from 3 different functions [duplicate]
I need to execute 3 functions in parallel and retrieve a value from each of them. Here my code: def func1(): ... return x def func2(): ... return y def func3(): ... return z ...
2 votes
1 answer
12k views
return values with thread.start() in python (using queue) [duplicate]
I'd like to create a multi-threaded version of a function. I discover t.start() returns None, so I have to use queue. I searched the documentation, but I don't understand how to use it in my example. ...
1 vote
1 answer
7k views
How to return a value from a thread in python? [duplicate]
I have written a code which sums the elements of array and prints it using multithreading. But instead of using a global value I want to use a local one and return it. However as i use return the ...
0 votes
2 answers
849 views
Python: Collect return values from threaded functions [duplicate]
I have written this sample code that generate random numbers using multiple threads. I can print each random number without any problems. But what I am trying to achieve is, I want to collect all the ...
4 votes
1 answer
837 views
Get return value from a function in thread in Python [duplicate]
I have written a Python function that uses multithreading. def image(link_ID): tid1 = Thread(target=displayImage, args=(link_ID,)) tid2 = Thread(target=publishIAmFree) tid1.start() ...
1 vote
1 answer
1k views
Threads append to list [duplicate]
How can I append the thread to the response list? import requests import threading def URLOK(url): page = requests.get(url, proxies=proxies) return url + ":"+ str(page.status_code)+"\n" ...
2 votes
2 answers
757 views
How to get a return value from a subroutine run inside a thread [duplicate]
I'm having trouble extracting return values from a subroutine I ran from within a thread, in python 3. import threading from threading import Thread def dothis(): x = 17 return x Thread(...
2 votes
0 answers
194 views
Threading with Decorator in Python [duplicate]
I am in search of a way to threading with wrapper, yet, the result of wrapped function MUST be still available. Via searching Stackoverflow, a not so perfect solution appreared. As the code below: ...
0 votes
1 answer
155 views
Python: Start a thread and have its returned value to a variable further down in the script [duplicate]
I am currently writing a program that is required to be as fast as possible. Currently, one of the functions looks like this: def function(): value = get_value() # Multiple lines of code ...
-1 votes
1 answer
131 views
How to get the returned value from a function after using Threading? [duplicate]
I have used python to make a program that can get the name of similar Movies. I have used threading to make sure that the functions run parallel to prevent time wastage. import threading import ...
0 votes
0 answers
133 views
Python threading module. Return function output from Thread class instance? [duplicate]
I tried the following but it is for multiprocess not threading Python threading return values how to get the return value from a thread in python? is a similar question but the answer also uses ...
0 votes
0 answers
47 views
saving function output in multithread python [duplicate]
I have the following code. What i am trying to do is to run many instances of function. In this case for example, the function bigbangtheory() would return df. Could you please advise how can i save ...
0 votes
0 answers
19 views
How to save the output of Multiple Threading to a variable in Python? [duplicate]
I am trying to save an output of multiple threading to the variable Output_1 and Output_2. My code is as follows. import multiprocessing from threading import Thread from multiprocessing import Pool ...
151 votes
11 answers
86k views
Python Process Pool non-daemonic?
Would it be possible to create a python Pool that is non-daemonic? I want a pool to be able to call a function that has another pool inside. I want this because deamon processes cannot create process....
72 votes
14 answers
112k views
Return value from thread
How do I get a thread to return a tuple or any value of my choice back to the parent in Python?