Heavy Timer in Separate Thread or Main Thread

There has been an ongoing issue with menu bar actions pausing timers. And last as i recall - going to a thread based approach didn’t help either. I’ve tried all manner of things and hoped that with all things now gone Cocoa - i would no longer have to worry about critical real-time events such as Garth mentioned being interrupted - i.e. blocked by some kind of mouse-action.

Have i missed something ? has this been solved ?

I seem to recall ending up going with MBS timers to help - there was also code in earlier Carbon days that helped problems with window dragging effecting this.

I need to update audio stream processes reliably - whether Cocoa or Portaudio.

I don’t spend much time in XOJO forums these days but have these things been solved ?

I tried TimerMBS and the menu-blocking thing seems still to be there. Is this an OS X problem ?

Isn’t this a sign that we just nee XOJO to grab the bull by the horns and at least allow SOME kid of pre-emptive threading in XOJO apps ?

PS I dont to ANY GUI stuff in my Audio/MIDI related threads ( not deliberately by design anyway )

[quote=218156:@Daniel Stenning]I tried TimerMBS and the menu-blocking thing seems still to be there. Is this an OS X problem ?

[/quote]

This does not seem relevant to this topic. Maybe you should start a new thread and explain more fully what you are referring to.

On OS X opening a menu blocks regular timers, this is the same in an Objective C or Swift application.

See NSTimer not firing when NSMenu is open in Swift for a solution (which will need some declares).

I am sorry but a quick experiment with a multiple timer and a system.debuglog in its action event does not stop ticking when menus of the app are opened. For once, Xojo maybe doing better than XCode…

El Capitan 10.11.1, Xojo 2015R2.4…

if my timer class doesn’t work as expected, please email me and tell me details. Else I can’t fix it.

Yes, and it works both cases: if the timer is in the main thread or in a secondary one.

Timers always fire in the main thread anyway, so placing them in a thread should not change anything.

Oh, technically I could make a timer which fires on a thread. Just it doesn’t help due to cooperative multitasking.

I was talking about standard, plain Xojo timers.