#!/usr/bin/python
#why doesn't this run both threads simultaneously?
#Thanks for any help.
#Chuckk
import threading
import time
def printesc(thrd):
for i in range(10):
time.sleep(1)
print thrd, i
def master():
thd1 = threading.Thread(target=printesc, args=(1,))
thd2 = threading.Thread(target=printesc, args=(2,))
thd1.run()
thd2.run()
master() 5 797
On May 20, 8:19*am, "Chuckk Hubbard" <badmuthahubb...@gmail.com>
wrote:
#!/usr/bin/python
#why doesn't this run both threads simultaneously?
#Thanks for any help.
#Chuckk
import threading
import time
def printesc(thrd):
* * for i in range(10):
* * * * time.sleep(1)
* * * * print thrd, i
def master():
* * thd1 = threading.Thread(target=printesc, args=(1,))
* * thd2 = threading.Thread(target=printesc, args=(2,))
* * thd1.run()
* * thd2.run()
master()
You meant 'thd1.start( )' and 'thd2.start( )'.
Chuckk Hubbard wrote:
#!/usr/bin/python
#why doesn't this run both threads simultaneously?
#Thanks for any help.
#Chuckk
Because you should call thread.start().
Diez
En Tue, 20 May 2008 10:28:51 -0300, castironpi <ca********@gmail.com>
escribió:
You meant 'thd1.start( )' and 'thd2.start( )'.
Wow! A message with a high S/N ratio coming from you!
And it's not the first I've seen - whatever pills you're taking, they're
good for you...
--
Gabriel Genellina
On Tue, May 20, 2008 at 8:24 PM, Gabriel Genellina
<ga*******@yahoo.com.arwrote:
En Tue, 20 May 2008 10:28:51 -0300, castironpi <ca********@gmail.com>
escribió:
>You meant 'thd1.start( )' and 'thd2.start( )'.
Wow! A message with a high S/N ratio coming from you!
And it's not the first I've seen - whatever pills you're taking, they're
good for you...
This is why I shouldn't be so eager adding people to the killfile.
--
Eduardo de Oliveira Padoan http://www.advogato.org/person/eopadoan/ http://twitter.com/edcrypt
Bookmarks: http://del.icio.us/edcrypt
On Tue, May 20, 2008 at 4:28 PM, castironpi <ca********@gmail.comwrote:
On May 20, 8:19 am, "Chuckk Hubbard" <badmuthahubb...@gmail.com>
wrote:
>#!/usr/bin/python
#why doesn't this run both threads simultaneously? #Thanks for any help. #Chuckk
import threading import time
def printesc(thrd): for i in range(10): time.sleep(1) print thrd, i
def master(): thd1 = threading.Thread(target=printesc, args=(1,)) thd2 = threading.Thread(target=printesc, args=(2,)) thd1.run() thd2.run()
master()
You meant 'thd1.start( )' and 'thd2.start( )'.
So I did. I was mixing what I read of thread and threading. I'll
never wander beyond my Python module reference html folder again.
Thanks for your help.
-Chuckk
-- http://www.badmuthahubbard.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anthony Baxter |
last post by:
On behalf of the Python development team and the Python community, I'm
happy to announce the release of Python 2.3.1 (final).
Python 2.3.1 is a pure bug fix release of Python 2.3, released in...
|
by: kanzen |
last post by:
I keep telling my friends that Python rocks. Now it's time to put my
money where my mouth is. I'm about to start writing a server for a
phone based game. It needs to handle simlpe requests from...
|
by: David Harrison |
last post by:
I am working on an application on Mac OS X that calls out
to python via PyImport_ImportModule(). I find that if
the imported module creates and starts a python thread,
the thread seems to be...
|
by: Qiangning Hong |
last post by:
I decide to seperate my data collection routine from my data analysis
and storage program to a seperate process, so I try to use the new
subprocess model in Python 2.4.
The main program spawns...
|
by: Yannick |
last post by:
Hi,
I would like to program a small game in Python, kind of like robocode
(http://robocode.sourceforge.net/).
Problem is that I would have to share the CPU between all the robots,
and thus...
|
by: momobear |
last post by:
I feel really puzzled about fellowing code, please help me finger out
what problem here.
import threading
class workingthread(threading.Thread):
def __init__(self):
self.quitEvent =...
|
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42)
Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86)
RFE : 262 open...
|
by: Ling |
last post by:
I am using boost.python to wrap C++ function which includes
directmusic libraries to simply play the midi, but lots of linkage
errors "error LNK2001: unresolved external symbol". I wonder if it is...
|
by: Matthew Wilson |
last post by:
In this code, I tried to kill my thread object by setting a variable on it
to False.
Inside the run method of my thread object, it checks a different
variable.
I've already rewritten this...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
| |