Application remains in system

This forum is for eXpress++ general support.
Post Reply
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Application remains in system

#1 Post by skiman »

Hi,

The following sometimes happens:
- In my application I'm using a lot of threads.
- Sometimes a thread is getting a problem, in my case I can simulate it by de-connecting the network plug. The thread is hanging because of the timeout on the network.
- I close the application with the normal procedure.

When I check the system afterwards, my application remains in the system processes. It looks as that blocked thread stays somewhere in memory.

Can I check all the threads when closing my application, and can I force them to close/destroy?
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Application remains in system

#2 Post by rdonnay »

Chris -

If a thread is still responding to events you can always push an event to it.
I use the below function to close all windows in all threads.

Code: Select all

FUNCTION CloseAllWindows()

LOCAL i, aChildList, nSeconds := Seconds()

DO WHILE !Empty( aChildList := Set_MainWindow():drawingArea:childList())

  FOR i := 1 TO Len(aChildList)
    IF !aChildList[i]:isDerivedFrom('XbpDialog')
      aChildList[i]:destroy()
    ELSE
      PostAppEvent(xbeP_Close,,,aChildList[i])
    ENDIF
    Sleep(10)
  NEXT

  IF Seconds() - nSeconds > 10
    EXIT
  ENDIF

ENDDO

Sleep(10)

RETURN nil
In eXpress++ build 259, I have improved the DC_InspectThreads() function to be able to display the stack and all work area information for all threads by using a similar technique.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Application remains in system

#3 Post by skiman »

Hi Roger,

Set_MainWindow() seems to be a function which is not standard eXpress++? I'm getting an error when I try to compile your code: 'Unresolved external symbol'.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Application remains in system

#4 Post by rdonnay »

This was just a get-set function that pointed to the main window dialog object.

You can change it to AppDeskTop():childList()[1].
That should also point to the main window.
The eXpress train is coming - and it has more cars.

Post Reply