core: remove option to support non-blocking and only allow platform to control main loop
This commit is contained in:
parent
710b5907a2
commit
caf297512c
4 changed files with 15 additions and 69 deletions
|
|
@ -14,25 +14,6 @@ pub fn main() !void {
|
|||
var mods: Modules = undefined;
|
||||
try mods.init(allocator);
|
||||
|
||||
// On some platforms, you can drive the mach.Core main loop yourself - but this isn't possible
|
||||
// on all platforms. If mach.Core.non_blocking is set to true, and the platform supports
|
||||
// non-blocking mode, then .mach_core.main will return without blocking. Otherwise it will block
|
||||
// forever and app.run(.main) will never return.
|
||||
if (mach.Core.supports_non_blocking) {
|
||||
defer mods.deinit(allocator);
|
||||
|
||||
mach.Core.non_blocking = true;
|
||||
|
||||
const app = mods.get(.app);
|
||||
app.run(.main);
|
||||
|
||||
// If you are driving the main loop yourself, you should call tick until exit.
|
||||
const core = mods.get(.mach_core);
|
||||
while (mods.mods.mach_core.state != .exited) {
|
||||
core.run(.tick);
|
||||
}
|
||||
} else {
|
||||
const app = mods.get(.app);
|
||||
app.run(.main);
|
||||
}
|
||||
const app = mods.get(.app);
|
||||
app.run(.main);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue