Re: Problem with Threads

2012-12-19 Thread Hans Mulder
On 19/12/12 18:11:37, Kwnstantinos Euaggelidis wrote: > I have this code for Prime Numbers and i want to do it with Threads.. > Any idea.?? Why would you want to do that? It's not going to be any faster, since your code is CPU-bound. You may have several CPUs, but CPython is going to use only one

Re: Problem with Threads

2012-12-19 Thread Dave Angel
On 12/19/2012 12:11 PM, Kwnstantinos Euaggelidis wrote: > I have this code for Prime Numbers and i want to do it with Threads.. Any > idea.?? Why do you want to do it with threads? Is it to speed up the processing? (Guessing that partly because of your printing "elapsed time." Chances are runni

Re: Problem ... with threads in Python

2005-10-26 Thread Jeremy Jones
Negoescu Constantin wrote: > Hello. > > I know that Python is */not fully threadsafe/*. Unlike Java, where > threading was considered to be so important that it is a part of the > syntax, in Python threads were laid down at the altar of Portability. > But, i really have to finish a projec

Re: Problem with threads

2005-07-18 Thread Peter Hansen
Stephan Popp wrote: > I've got a problem with stopping python-threads. > I'm starting a thread with twisteds reactor.deferToThread which start a > methodcall in a seperate thread. In this thread a swig-wrapped c++ module is > running. > Now I want to stop the running thread from the main thread

Re: Problem with threads

2005-07-18 Thread Simon Dahlbacka
You cannot really do that*. Use a flag or something that the thread checks if it should shut down. /Simon * well actually you can, sort of by using int PyThreadState_SetAsyncExc( long id, PyObject *exc) from C API. However, if you do that you swap one problem for a sh*tload of others, because of