I have this code for Prime Numbers and i want to do it with Threads.. Any
idea.??
# prime numbers are only divisible by unity and themselves
# (1 is not considered a prime number by convention)
import time
def isprime(n):
if n == 2:
return 1
if n % 2 == 0:
return 0
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 running
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
Yes
On Wed, Feb 27, 2008 at 3:56 AM, [EMAIL PROTECTED] wrote:
On Feb 26, 7:56 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Tue, 26 Feb 2008 01:46:48 -0200, Manikandan R [EMAIL PROTECTED]
escribió:
Hai,
Is it possible to share a single variable between multiple
En Tue, 26 Feb 2008 01:46:48 -0200, Manikandan R [EMAIL PROTECTED]
escribió:
Hai,
Is it possible to share a single variable between multiple
threads. For eg:
Class A:
thread_init()
def run():
fun1()
def fun():
assume some arithmatic
On Feb 26, 7:56 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Tue, 26 Feb 2008 01:46:48 -0200, Manikandan R [EMAIL PROTECTED]
escribió:
Hai,
Is it possible to share a single variable between multiple
threads. For eg:
Class A:
thread_init()
def
Hai,
Is it possible to share a single variable between multiple
threads. For eg:
Class A:
thread_init()
def run():
fun1()
def fun():
assume some arithmatic operation is going on according to the
input given and each fun will *give different
Hai,
Is it possible to share a single variable between multiple
threads. For eg:
Class A:
thread_init()
def run():
fun1()
def fun():
assume some arithmatic operation is going on according to the
input given and each fun will *give different
Hello.
Iknow 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 project which uses multiple threads in
Python, and
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 project
Hi all,
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 or another one, and
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
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 or
13 matches
Mail list logo