multithreading - The Programming Theory Gods Strike: What is target = foo in Python 2.x? -
often have been browsing q & site, answers use multi-threading , processing have told me use format goes this:
(target=foo, args=(bar, baz))
it used in multiprocessing , multithreading (at least limited knowledge.)
my question is, what target
mean, , can explain how used?
i have not been able find explanation in docs or elsewhere.
the keyword argument target
in threading.thread
's constructor sets entry-point of new thread. can function or object has __call__
method.
here's example using function:
import threading def foo(number, name): print 'hello new thread' print 'here arguments:', number, name thread = threading.thread(target=foo, args=(5,'bar')) thread.start() thread.join()
Comments
Post a Comment