Platforms to show: All Mac Windows Linux Cross-Platform
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
global method | System | MBS Util Plugin | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The application should take nearly 0% CPU Power till time has gone.
If you need more options like blocking other RB threads, check the DelayMBS method with mode parameter.
Another example from Kirk Clendinning:
Property: lastupdate as Integer
Sub YieldProcessorTime(periodticks as Integer, widthmilliseconds as Integer)
// use the Monkeybread Software delay to yeild time for a screen update
// every period*ticks for a pulse width of width milliseconds
if ticks>lastupdate+periodTicks then
delayMBS widthmilliseconds/1000
lastupdate=ticks
end if
exception err
ExceptionReport(err, "Utils:Methods:YieldProcessorTime")
end sub
YieldProcessorTime(15, 20) gives me a delay of 20ms every 250ms. But,
since the delayMBS yields time more efficiently than using a RB thread, this turns out to be a much more effective way to update progress bars etc.
I don't need the delay per se, but since RB still hasn't written a good yield function (that I know of) your delayMSB works instead.
Please use optional mode flags with DelayDontWaitNextEvent when using on thread.
Using DelayMBS on Web Applications can cause problems as the server is paused than for all clients, a really bad thing.
See also:
Some examples using this global method:
- /MacCF/Carbon Events/Carbon Events Test
- /MacClassic/Speech/Speech recorder
- /MacCocoa/NSStatusItem/Logintime in menubar
- /MacCocoa/NSStatusItem/Name in menu bar
- /MacCocoa/NSStatusItem/Statusitem with PopOver
- /MacCocoa/NSStatusItem/Statusitem with slider in menubar
- /MacCocoa/NSStatusItem/Statusitem with textfield in menubar
- /MacFrameworks/FSEvents/FSEvents on Boot Device Console
- /Phidgets/Old Phidget Classes/Phidget Manager
- /Util/Threads/DelayMBS Thread Test
DelayMBS(time as Double, mode as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
global method | System | MBS Util Plugin | 6.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Like DelayMBS with one parameter but additional mode parameter:
combine the following constants:
const DelayDontMPYield = 1 | // Don't give additional time for other OS threads |
const DelayDontRBYield = 2 | // Don't give Xojo time for other Xojo threads |
const DelayDontThreadYield = 4 | // Don't give addition time for other OS threads |
const DelayDontQuickTimeYield = 8 | // Don't give time for QuickTime Movieplayer |
const DelayDontWait = 16 | // Don't give CPU time for other OS threads |
const DelayDontWaitNextEvent = 32 | // Don't give CPU time to handle events on Mac OS X to avoid beachball cursor |
const DelayDontSleep = 64 | // Don't give CPU time for other OS threads (Windows) |
Using DelayDontWaitNextEvent may show the beach ball cursor, but will have the OpenDocument event working as other AppleEvents. Please use DelayDontWaitNextEvent option for running on threads.
Using DelayMBS on Web Applications can cause problems as the server is paused than for all clients, a really bad thing.
See also:
Some examples using this global method:
- /MacCocoa/NSStatusItem/Logintime in menubar
- /MacCocoa/NSStatusItem/Name in menu bar
- /MacCocoa/NSStatusItem/Statusitem with textfield in menubar
- /Network/Bonjour/Bonjour Console
- /Phidgets/Old Phidget Classes/PhidgetMotorControl Test with Events
- /Util/Delay
- /Util/Make Foreground Process
- /Util/Restart App on Mac
- /Util/Threads/DelayMBS Thread Test
- /VLC/Thumbnailer GUI
Blog Entries
- MBS Xojo Plugins, version 22.1pr1
- MBS Xojo / Real Studio Plugins, version 16.0pr8
- MBS Xojo / Real Studio Plugins, version 13.4pr5
- MBS Xojo / Real Studio Plugins, version 13.4pr4
- MBS Real Studio Plugins, version 13.1pr7
Xojo Developer Magazine
The items on this page are in the following plugins: MBS Util Plugin.