Page 1 of 1

[Windows 10&PB 5.42 b1] PostEvent delay?

Posted: Mon Feb 01, 2016 3:52 pm
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?

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

Posted: Mon Feb 22, 2016 1:56 am
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:

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

Posted: Mon Feb 22, 2016 9:42 am
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