Page 1 of 1

Killing a 2D accelerated program is slow with threading

Posted: Sun Apr 01, 2018 6:58 pm
by Mistrel
When debugging I often use the "Kill Program" button from the IDE as it's often time consuming to always go through the motion of closing it gracefully through whatever means are configured.

I just started using the Sprite library for the first time today and noticed that killing a program from the IDE with threading enabled causes the program to hang for a bit before finally closing.

Is there any way to speed this up? My brain always hemorrhages when this occurs as I mentally twiddle my thumbs until the IDE becomes available to me again.

I don't know if this is an issue for other OSs. I am running Windows 10 x64.

Run the following program with threading ENABLED:

Code: Select all

Enumeration
  #WINDOW_Main
  #SPRITE_Cursor
EndEnumeration

InitSprite()

OpenWindow(#WINDOW_Main,150,150,300,300,"")
OpenWindowedScreen(WindowID(#WINDOW_Main),0,0,300,300,#True,0,0)

CreateSprite(#SPRITE_Cursor,1,1,#PB_Sprite_PixelCollision|#PB_Sprite_AlphaBlending)

Repeat
  Event=WaitWindowEvent(1)
  
  DisplaySprite(#SPRITE_Cursor,0,0)
Until Event=#PB_Event_CloseWindow

Re: Killing a 2D accelerated program is slow with threading

Posted: Mon Apr 02, 2018 1:43 am
by Dude
Your example only "hangs" for about half a second on my Win 7 PC, when i click the kill button in the IDE.

But you're onto something: I've seen a situation where I showed a MessageRequester() in a thread, the MessageRequester() stays up (until i click "OK") even though the app was killed and I even totally quit PureBasic. I wondered if this was normal.