Killing a 2D accelerated program is slow with threading

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Killing a 2D accelerated program is slow with threading

Post 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
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

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

Post 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.
Post Reply