Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Aborting compilation seems to be broken

<< < (2/6) > >>

thomas:

--- Quote from: tiwag on August 02, 2006, 09:54:52 pm ---ok that explains it

but how does ProcessExplorer kill them ?
with this tool i'm able to kill the process without problems,
maybe we can use the same method ... ?

--- End quote ---
We can kill it, no problem. But we don't want to.

What we do is we send the process SIGTERM. Under Linux, every decent program understands this as a kick in the rear with the demand to get lost as soon as possible, albeit in a gentle manner.

Under Windows, nothing happens if you send SIGTERM. It is simply not implemented.

What ProcessExplorer does (in Posix terms) is SIGKILL, which we do not want to use because it just kills the process in an uncontrolled manner. Even though it probably works, sigkilling a program is not nice. You don't really know what happens, files may stay locked or be left in an inconsistent state, memory may not be freed, anything...


EDIT:
For completeness, it should be mentioned that wxWidgets implements a workaround for Windows by sending a WM_CLOSE notification. This implements a SIGTERM-like graceful shutdown behaviour for GUI apps. However, this only works if the application has a window, and gcc obviously doesn't.

kagerato:

--- Quote from: thomas on August 02, 2006, 11:12:26 pm ---EDIT:
For completeness, it should be mentioned that wxWidgets implements a workaround for Windows by sending a WM_CLOSE notification. This implements a SIGTERM-like graceful shutdown behaviour for GUI apps. However, this only works if the application has a window, and gcc obviously doesn't.

--- End quote ---

For applications running within a console instance (cmd.exe, generally), there is a mechanism for shutting down as the console itself is destroyed.  See "More on Process Termination".  I don't believe this is pertinent in CodeBlocks' case, though.  Do you allocate a console at any point, or merely invoke the applications directly?  It appears to be the latter, so far as I can tell.

tiwag:
@thomas
it's nice trying to be gentle, but under Windoze it's quite useless ...

when you start for example a compilation of a wx pch erroneously with warning option "-W"
you get thousands of warnings and it lasts ages until it completes.

the only way is to kill the process ( btw. i never got any locked files or any problems with unfreed memory or a corrupted heap or whatever )

i see now the reasons for this behaviour and think it is better done with an external tool
and not necessary to be implemented into CodeBlocks Abort code.

thanks for the infos

Ceniza:
Windows should take care of unlocking files and freeing memory if a process is killed... at least any recent version should do that.

It's completely ugly sending a SIGKILL (or any other mechanism to achieve the same goal) but I wouldn't mind :P

tiwag:

--- Quote from: Ceniza on August 03, 2006, 04:39:51 am ---... but I wouldn't mind :P

--- End quote ---

me too :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version