ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> komodo-discuss
komodo-discuss
[Komodo-discuss] can not run this thread?
by Pujo Aji other posts by this author
Apr 24 2005 7:08AM messages near this date
view in the new Beta List Site
RE: [Komodo-discuss] Re-activate menu | [Komodo-discuss] Fedora Core 4 test 2
Hello, I tried this program using pydev (eclipse add on) and also run
it from dos shell, it is working,
but when I used komodo it gives error message, if I use 100 threads 
then my cpu works 100%.
Why is that happened?

This program contains only 1 class hit which has field self.i which
will be increase 1 in each thread.

class hit:
  def __init__(self,lock):
    self.i = 0
    self.lock = lock
    
  def incI(self):
    self.lock.acquire()
    self.i+=1
    self.lock.release()

def myfunction(string, sleeptime, myhit):
  myhit.incI()
  print string
  time.sleep(sleeptime)
    
if __name__ == '__main__':
  lock = thread.allocate_lock()
  myhit = hit(lock)
  myhit.i = 0

  JumTot = 1000
  for i in range(JumTot):
    thread.start_new_thread(myfunction,('Thread '+str(i),0.01,myhit))

  while myhit.i<JumTot:
    pass
    
  print 'Good Job'  


Please help, is this komodo bugs?

Pujo Aji

_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved