Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Can't Delete a Thread

Reply
Thread Tools

Can't Delete a Thread

 
 
flamesrock
Guest
Posts: n/a
 
      04-06-2006
I have the following two threads, called from a method:

def uploading_region:
uploading_region =
AddRegionToServerThread(self,self.SESSION,create_r egion)
while uploading_region.UPLOADING:
pass
#escape method when uploading_region thread is false

class AddRegionToServerThread(Thread):
def __init__(self, window, session, dict):
Thread.__init__(self)
self.SESSION = session
self.DICT = dict #contains dbuser,password, etc
self.STATUS = 'Uploading the region. Please wait...'
self.WINDOW = window
self.dlg = wx.ProgressDialog('Please Wait...', self.STATUS,
100, self.WINDOW, wx.PD_AUTO_HIDE | wx.PD_APP_MODAL)
self.RETICULATE = ReticulateSplines(self.dlg)
self.UPLOADING = True
self.start()

def run(self):
self.STATUS = 'Adding cities to database. Almost done...'
#create database
....
self.RETICULATE._Thread__delete()
time.sleep(3) #give some extra time
self.UPLOADING = False

class ReticulateSplines(Thread):
def __init__(self,dialog):
Thread.__init__(self)
self.random_messages=[
'reticulating splines','hiring code monkeys','are you still
watching this?',
'a penny saved is a penny earned','use this as an
opportunity to go outside',
'mmm water','drinking decaff coffee','neutering excess
bits',
'starting improbability drive','delousing edmontonians']
self.dialog = dialog
self.x=1
self.start()

def run(self):
self.x += 2

self.dialog.Update(self.x,self.random_messages[random.randrange(len(self.random_messages))])
time.sleep(3)
self.__init__(self.dialog)




Now for some reason, I can't delete the thread 'ReticulateSplines' in
the run() function of AddRegionToServerThread(). I call it, but the
dialog window doesn't actually close, while, for some reason I am able
to terminate AddRegionToServerThread.

Any ideas on why? I've tried a combination of things and yet nothing
works.

Any help would be greatly appreciated.

-Thanks
Flamesrock

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To delete or not to delete? Lethal Computer Support 15 07-24-2005 11:47 PM
Can someone tell me why I can't delete this file? and why it blue screens WinXP Pro on delete? zZz Computer Support 1 01-12-2005 02:37 AM
Cannot Delete, (The Delete Key Won't Work) Lee Something Computer Support 13 10-15-2003 09:51 PM
Overloading new[] and delete[]: how do they vary from new and delete? HeroOfSpielburg C++ 1 08-06-2003 03:58 AM
delete on delete ! Sandeep Grover C++ 19 07-22-2003 10:09 AM



Advertisments