Based on this thread, in Python, one can retrieve the returned value (a variable length string) of a function using a multiprocessing.Queue. But this involve to actually modify the function itself (by returning Q.put(retval)
instead of retval
).
What if one cannot modify the function (e.g. because it's was design as it is, also for other purposes such as an other usage which doesn't involve a call to a new thread)? Is it still possible to easily get the returned string value from this function when calling it through the multiprocessing library? And if yes, how?