Threads in PyGTK: keep typing while ping-ing

Mamahita Sela mamahitasela at yahoo.com
Mon Feb 16 20:53:11 EST 2009


Dear FB,

> As you have been already told, join() blocks until the
> thread is
> terminated. and you should avoid that.
> A simple fix could by add a timeout to t.join, doing
> something like :
>         t.join(JOIN_TIMEOUT);
>         if not t.isAlive():
>             print t.result
> 

Thanks for your great sample. And, thank you for your tips on speedup the ping stuff. 

However, i still have problem when adding timeout to join(). 
- It works, but only print out thread result that is not alive, as we put in the code. So, i never get result from unsuccessful ping action, which might take more time than timeout specified. 
- I still have little delay in GUI. Is it possible to make it smooth in GUI operation? When i put more timeout (say: 0.5 from 0.2), i will have to wait  longer.

PS: thanks for pointing out inefficient ping action :) I will follow the tips. But, another time I might need to do something else, like downloading files, or checking for serial devices. So, this thread thing, imho, is very important. 

Any help would be very appreciated.
M.


      




More information about the Python-list mailing list