Re: Timer issue?

giulio-yFZTWCmGK/pWk0Htik3J/[email protected] Wed, 1 Aug 2018 14:06:52 +0200
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <6084bd08-45ac-4c73-b7c3-d0a611e749f0@Spark>
Hi Jean-Luc,

did you try to set the timer period to a considerably longer interval?

just to understand if in the 10 milliseconds (that’s really a short interval maybe also for a computer), the timer event is fired again before completing its tasks, including set itself to off…

you could try maybe a quarter of second, that anyway is nothing if you are handling a series of files sequentially

just a guess,

 Giulio

Giulio Mastrosanti
BitBazar srl
06 39737052 / 06 39725787
Il 1 ago 2018, 12:43 +0200, Jean-Luc Arnaud <[email protected]>, ha scritto:
> Hi all,
>
> I'm using a timer in order to terminate a thread treatment:
>
> - When finished, the thread sets a flag to True and terminates (verified),
>
> - In the Timer (with a period of 10), when the flag is on, the timer
> sets itself to off and then calls a method selecting the next file to be
> treated.
>
> Globally, this works but sometimes, I'm getting a "File already opened"
> error that I send when this method tries to open the same file that is
> already opened. This should never happen !!! It's like the method is
> called again whereas it has already opened a new file and tries to
> reopen it ! I have verified that this is always a new file, never the
> last treated file.
>
> Here is what I'm getting raising a Runtime error when this happens:
>
> RuntimeRaiseException
> MainWindow.MainWindow.Next_File%%o<MainWindow.MainWindow>
> MainWindow.MainWindow.Refresh_Timer_Action%%o<MainWindow.MainWindow>o<Timer>
> XojoFramework$13892
> __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
> __CFRunLoopDoTimer
> __CFRunLoopDoTimers
> __CFRunLoopRun
> CFRunLoopRunSpecific
> RunCurrentEventLoopInMode
> ReceiveNextEventCommon
> _BlockUntilNextEventMatchingListInModeWithFilter
> _DPSNextEvent
> -[NSApplication(NSEvent)
> _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
> XojoFramework$4483
> XojoFramework$4484
> Application._CallFunctionWithExceptionHandling%%o<Application>p
> _Z33CallFunctionWithExceptionHandlingPFvvE
> XojoFramework$4483
> -[NSApplication run]
> RuntimeRun
> REALbasic._RuntimeRun
> _Main
> main
>
> Can you help me understand what's happening ?
>
> TIA
>
> --
> Jean-Luc Arnaud
>