checking a thread has started
Josiah Carlson
jcarlson at uci.edu
Sat Nov 6 18:18:59 EST 2004
Deepak Sarda <deepak.sarda at gmail.com> wrote:
>
> On Sat, 06 Nov 2004 09:30:59 -0800, Josiah Carlson <jcarlson at uci.edu> wrote:
> This seems like a way to workaround the problem. I'll try it on Monday
> and get back if it works. But this does bring up the point that
> threading.Thread() should provide some mechanism by which a thread's
> inability to start should be known. a return value or something. (I am
> a newbie to threads - python is the first language I am trying threads
> in so please educate me if I have wrong notions! :-)
If a thread doesn't start due to lack of resources, I think it should be
raising an exception.
As an aside, I wrote a little script that creates 1000 threads, does a
busy loop for a short time, then exits; it had no problems with a few
hundred threads at a time (though it was a bit slow), and I didn't see
any exceptions. Perhaps I should have been incrementing a counter when
it started and finished.
> > As an aside, are you sure you need 15 threads? Seems a little over the
> > top to me.
>
> I do. This program sits on top of a cluster and ferries jobs to the
> compute nodes - an embarrassingly parallel problem with fifteen
> subtasks.
Sounds like a job for asyncore (if you can handle asynchronous
servers/clients).
- Josiah
More information about the Python-list
mailing list