Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » I keep getting the same "cannot open exe for writing" error...
Re: I keep getting the same "cannot open exe for writing" error... [message #50700 is a reply to message #50697] Thu, 06 December 2018 20:53 Go to previous messageGo to previous message
peterh is currently offline  peterh
Messages: 46
Registered: November 2018
Location: Germany
Member
I have now changed the code in the following way:

		if(hProcess != INVALID_HANDLE_VALUE) {
			DebugActiveProcessStop(processid);
			TerminateProcess(hProcess, 0);
			DWORD retval = MsgWaitForMultipleObjects(
                                      1, 		//DWORD        nCount,
                                      &hProcess, 	//const HANDLE *pHandles,
                                      true, 		//BOOL         fWaitAll,
                                      10000, 		//DWORD        dwMilliseconds,
                                      0  		//DWORD        dwWakeMask
				      );
			if (retval == WAIT_TIMEOUT)   Exclamation("WAIT_TIMEOUT");
			if (retval == WAIT_ABANDONED) Exclamation("WAIT_ABANDONED");
		
			WaitForSingleObject(hProcess,10000);
			while(threads.GetCount())
				RemoveThread(threads.GetKey(0)); // To CloseHandle
			UnloadModuleSymbols();
			SymCleanup(hProcess);
			CloseHandle(hProcess);
		}



I did this because I have read, the WaitForSingleObject() call can return prematurely under some special circumstances.
I cannot explain it, because Microsoft cannot explain it clearly. Twisted Evil
The explanations given are misunderstandable or ambigous and there are subtile typos sometimes. And no examples Crying or Very Sad
I simply try it, if someone understands this perfectly, it will be appreciated.
After I did this, something changed: Stopping the debugee needs about 4 seconds, which is perfectly ok for me.
Edit: I added some debug code
The reason for the 4 seconds delay is not WAIT_TIMEOUT and is not WAIT_ABANDONED.
I will add some code to log the reason tomorrow. (Still I am learning Upp, needs more time than usual)
Ok, I will try this over the next few days and then report again.

So long,

Peter

[Updated on: Thu, 06 December 2018 22:40]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: error: expected unqualified-id before '=' token
Next Topic: clang or MinGW
Goto Forum:
  


Current Time: Sun Jul 05 01:43:00 CEST 2020

Total time taken to generate the page: 0.01833 seconds