[Windows 10&PB 5.42 b1] PostEvent delay?

Windows specific forum
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 543
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

[Windows 10&PB 5.42 b1] PostEvent delay?

Post by bbanelli »

Greetings,

here's the code:

Code: Select all

EnableExplicit

CompilerIf #PB_Compiler_Thread = #False
  CompilerError("Select Thread safe in compiler options")
CompilerEndIf

Enumeration #PB_Event_FirstCustomValue
  #Event_ThreadMessage
  #EventType_ProgressBar
EndEnumeration

Procedure OnThreadMessage()
  Select EventType()
    Case #EventType_ProgressBar
      StatusBarProgress(0, 0, PeekI(EventData()))
  EndSelect
  ProcedureReturn
EndProcedure

Procedure foo(*p)
  Protected.i iter
  For iter = 0 To 7
    PostEvent(#Event_ThreadMessage, #PB_Ignore, #PB_Ignore, #EventType_ProgressBar, @iter)
    Delay(750)
  Next
  ProcedureReturn
EndProcedure

Define StartTime, ElapsedTime

If OpenWindow(0, 100, 150, 300, 100, "PureBasic - StatusBar Example", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  StartTime = ElapsedMilliseconds()
  TextGadget(0, 10, 10, 100, 20, Str(ElapsedTime) + " ms")
  If CreateStatusBar(0, WindowID(0))
    AddStatusBarField(300) : StatusBarProgress(0, 0, 0, #Null, 0, 10) 
  EndIf
  BindEvent(#Event_ThreadMessage, @OnThreadMessage())    
  CreateThread(@foo(), #Null)
  Repeat
    ElapsedTime = ElapsedMilliseconds()-StartTime
    SetGadgetText(0, Str(ElapsedTime) + " ms")
  Until WaitWindowEvent(10) = #PB_Event_CloseWindow Or ElapsedTime > 6000
EndIf 
If I run this code from Windows XP to Windows 7, progress bar follows update every 750ms. However, on Windows 10, progress bar status doesn't change only after ~1500 ms.

Windows 10
http://youtu.be/clPVQDpVkUs?hd=1

Windows 7
http://youtu.be/mbjfoRAO1GQ?hd=1

Am I doing something wrong or this is a bug of some sort?
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: [Windows 10&PB 5.42 b1] PostEvent delay?

Post by Thunder93 »

It doesn't seem to be a problem with PureBasic 5.42 Beta 3 ... and of course, running under Windows 10. Works instantly, unlike under PB 5.31. :wink:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 543
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Re: [Windows 10&PB 5.42 b1] PostEvent delay?

Post by bbanelli »

Thunder93 wrote:It doesn't seem to be a problem with PureBasic 5.42 Beta 3 ... and of course, running under Windows 10. Works instantly, unlike under PB 5.31. :wink:
Sure it does, since it was a bug after all, reported and fixed by dear Fred. :)

http://www.purebasic.fr/english/viewtop ... =4&t=64903
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
Post Reply