Ronnie Ward wrote:
>> Does your app use threads?
>
> Yes, I am using timeout and repeat_timeout.
I don't think those are causing the threads.
AFAIK, FLTK's timers are single threaded/event driven.
For instance, the test/clock.exe program uses Fl_Clock
which uses FLTK timers, and runs showing only one thread.
> The thread count is 8 while my app window is active.
Hmm, that's a lot, so I'd think your app must be creating
those threads on its own, either with CreateThread() or similar.
AFAIK, FLTK doesn't create threads on its own within windows.
Or at least, a 'grep -r CreateThread' on the fltk/src directory
shows nothing.
I'm thinking something else is afoot.
What happens if you /don't/ specify the /ENTRY:"mainCRTStartup" flag..
I don't think I've ever needed that flag before when building FLTK apps,
and I've built both /SUBSYSTEM:WINDOWS and /SUBSYSTEM:CONSOLE apps.
I've only ever needed to change that flag to change the app's behavior.
With /SUBSYSTEM:WINDOWS the app should start with no DOS window
and should 'background' itself when run from the command line
(ie. the prompt should return immediately), and your app should have
no WinMain() defined. (fltk handles defining WinMain())
> When I close it, the thread count still shows 8 for the ghost process I'm
> trying to eliminate.
Sounds weird that 'exit(0)' isn't immediately exiting your program.
It should just shutdown and die right away.
Try calling "_exit(0);" instead (leading underbar), in case your
app is hanging up during calls to the destructors.
IIRC, exit(0) will call your destructors, whereas _exit(0)
will simply exit the program, and free memory en masse.
I would say "something" within your app is preventing it from
closing down; if _exit(0) makes it quit, but exit(0) does not,
that would be a strong indication it's probably one of your
destructors.
I'd suggest when you quit the app and it's still running,
immediately attach a debugger, and stop the process to see
where it's hung up.
> What I need to do is catch the app close click, and terminate the app
> normally.
Redefining the window callback() is the way to do it,
but since you're calling exit(0) and it's not exiting,
I can only think it's the destructors in your app.
But the debugger will tell you what's really going on.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk