Latest recipes tagged "run_asynchronously"http://code.activestate.com/recipes/tags/run_asynchronously/new/2009-03-10T01:38:51-07:00ActiveState Code RecipesSimple threading decorator (Python)
2009-03-10T01:38:51-07:00david.gaarenstroomhttp://code.activestate.com/recipes/users/4168848/http://code.activestate.com/recipes/576684-simple-threading-decorator/
<p style="color: grey">
Python
recipe 576684
by <a href="/recipes/users/4168848/">david.gaarenstroom</a>
(<a href="/recipes/tags/async/">async</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/run_asynchronously/">run_asynchronously</a>, <a href="/recipes/tags/thread/">thread</a>, <a href="/recipes/tags/threading/">threading</a>).
Revision 4.
</p>
<p>When you're new at threading, using threads can be a bit daunting at first. If all you want is just to "run this function in parallel (= asynchronously) to the main program code", then this recipe can be of use. Simply use "@run_async" as a decorator for the function you want to run asynchronously. A call to that function will return immediately but the function itself will run in parallel.</p>