Making thread run after program exits Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
miclus
Can't get richer than this
Can't get richer than this
Posts: 747
Joined: Tue Mar 31, 2009 2:11 am

Making thread run after program exits

Post by miclus »

Hi. How can I make a wxThread continue to run even after my program terminates? Basically, at the end of my program, I upload a file that gets created, but I don't want to wait for it on the screen, so I just start the thread and my program ends. But, so does the thread. I'm trying to make the thread continue on.
TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV »

When program exits, hide all GUI and wait until download is finished, then really exit.
Debster
Knows some wx things
Knows some wx things
Posts: 32
Joined: Sat Aug 20, 2005 6:01 pm

Post by Debster »

A thread can't run after the program exists. A thread runs in the context of it's process in your case the application. End the process and all threads are terminated. It's a windows thing, did you mentioned your os?
Anyway under windows the only solution for you is to start a process in your app to upload the file. However since Vista you need the users permission for that.
protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

Post by protocol »

Sounds like a setup for a troubled design.

It may be best to keep the application running. Use the taskbar to keep the process available.

What if the upload fails, or some other error that the user may need to handle occurs?

Also, as a user I would like to know whats going on; don't try to "hide" application activity from a user. You setting yourself up for a bad user experience.
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!
Virchanza
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Sun Jul 19, 2009 6:12 am

Post by Virchanza »

I like TrV's idea of simply hiding the main GUI.

That's what Firefox does if you close it while there's something currently downloading.
Post Reply