473,604 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't Delete a Thread

I have the following two threads, called from a method:

def uploading_regio n:
uploading_regio n =
AddRegionToServ erThread(self,s elf.SESSION,cre ate_region)
while uploading_regio n.UPLOADING:
pass
#escape method when uploading_regio n thread is false

class AddRegionToServ erThread(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.ProgressDial og('Please Wait...', self.STATUS,
100, self.WINDOW, wx.PD_AUTO_HIDE | wx.PD_APP_MODAL )
self.RETICULATE = ReticulateSplin es(self.dlg)
self.UPLOADING = True
self.start()

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

class ReticulateSplin es(Thread):
def __init__(self,d ialog):
Thread.__init__ (self)
self.random_mes sages=[
'reticulating splines','hirin g code monkeys','are you still
watching this?',
'a penny saved is a penny earned','use this as an
opportunity to go outside',
'mmm water','drinkin g decaff coffee','neuter ing excess
bits',
'starting improbability drive','delousi ng edmontonians']
self.dialog = dialog
self.x=1
self.start()

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

self.dialog.Upd ate(self.x,self .random_message s[random.randrang e(len(self.rand om_messages))])
time.sleep(3)
self.__init__(s elf.dialog)


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

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

Any help would be greatly appreciated.

-Thanks
Flamesrock

Apr 6 '06 #1
0 946

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

32
3165
by: Christopher Benson-Manica | last post by:
Is the following code legal, moral, and advisable? #include <iostream> class A { private: int a; public: A() : a(42) {}
12
3044
by: Arno R | last post by:
Hi there, I just distributed an application in which I (try to) change db.properties depending on CurrentUser() For instance I set the property's AllowBypassKey and AllowBuiltinToolbars to False when CurrentUser() <> "xx" I just noticed that the property's can only be changed changed by a user belonging to 'Admins'. I never noticed this before. I could swear that in other apps (A97) this works fine without the user being an admin... ...
12
7986
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files File.Delete(Filename) Next Catch ex As Exception
4
3974
by: Stanislaw Tristan | last post by:
CREATE RULE "new_rule2" AS ON DELETE TO "public"."klients_view" DO INSTEAD ( DELETE FROM klients WHERE (klients.klient_id = old.klient_id); DELETE FROM klient_services WHERE (klient_services.klient_id = old.klient_id);
12
2029
by: dennist685 | last post by:
Can't edit, delete or add row in an Access database in a website 2003 When I implement a walkthrough using Northwind I have no trouble doing this. Also, in a windowsforms project I have no problem editing, adding or deleting rows. But in webforms the smarttags don't offer the options. Can anybody help?
5
3487
by: Sam777 | last post by:
I was under the impression that creating the app_offline.htm file at the root of the webapp would cause all handles to be closed so that the app could be removed. Unfortunately, this isn't the case. One handle remains open. Debugging shows that it's actually the IIS cache and not ASP.NET that owns this handle. During IIS shutdown, the handle is closed with the following stack trace: ChildEBP RetAddr 0006fbe4 5a403e05...
5
2907
by: morz | last post by:
classA { public: thirdPartyThreadLibrary myThread; void Run() { myThread.exec(); // created new thread and run on background. }
5
2124
by: Angus | last post by:
Hello I am doing this in a worker thread: char* szPartial = new char; if (szPartial) { lstrcpy(szPartial, szBuffer); PostMessage(m_thishWnd, WM_USER+1, 0, (LPARAM)szPartial); }
12
1930
by: better_cs_now | last post by:
Hello all, I suspect that a threading issue is leading to an object being destructed in one thread context while one of its member functions is still running in another thread context. As a means of confirming this, I would like to have the object check if it is alive in the referenced member function and report to me if it is not. However, I cannot think of a standards-compliant way for an object to know that it has been destructed.
0
8419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5441
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3907
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1526
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.