Answers for "how to get thread name from function in python"

1

python returen Thread

def foo(bar, baz):
  print 'hello {0}'.format(bar)
  return 'foo' + baz

from multiprocessing.pool import ThreadPool
pool = ThreadPool(processes=1)

async_result = pool.apply_async(foo, ('world', 'foo')) # tuple of args for foo

# do some other stuff in the main process

return_val = async_result.get()  # get the return value from your function.
Posted by: Guest on March-03-2021
1

how to change a thread name in python

#do this
import threading
threding.current_thread().name = "name_of_the_thread"
Posted by: Guest on August-23-2020

Code answers related to "how to get thread name from function in python"

Python Answers by Framework

Browse Popular Code Answers by Language