• Archives
  • Handlers
  • Dispatch
  • Settings
  • Clipboard



Dispatch

The TDispatch class subclasses from AThread, an abstract class that uses the host system to create a Posix thread that runs independently of the host UI thread. The Guildhall dispatcher gathers all events from an event queue filled by both the host system and Guildhall applets. It then prioritizes them and distributes them according to the current Guildhall desktop structure. This is intentionally reminiscent of how Classic Mac worked as can be seen in the following diagram.

This scheme worked quite well until Apple's Big Sur release. Yes, it's cooperative multitasking, not preemptive multitasking, but in practice I haven't noticed much difference. And for my purposes, it's convenient that all the synchronization issues go away. If an applet has the thread, no other applet is running. It simplifies a lot of coding issues.

But, as shown above, this scheme relies upon having asynchronous access to the screen (as a full-screen window), independent of what the host UI thread is doing. Until the Big Sur release the full-screen window context was available. Sadly, the call to get the window's context returns NIL in Big Sur (the broken red arrow in the diagram). Apple's phone OS never supported asynchronous access, and the sucky phone OS won. Sad. Forunately it has been years since Apple added anything interesting to their OS, so staying on macOS Sierra works quite well for my purposes.

I did take a stab at making Guildhall work with the sucky phone OS. I tried teaching Guildhall to consolidate all its screen updates so it could draw them all at once when the host event thread got around to visiting. Performance absolutely sucked. Maybe I missed something obvious (and if so the code for that failed attempt is still around) but it started to feel like a lot of other fights with MacOS X (nee NeXT Step), a slippery slope that would lock my reasonably cross-platform code base into the sucky phone OS. I'm pretty sure it's possible. There seem to be large applications on macOS whose developers have kept their cross-platform C++ code bases working. Some of them are even open source, so I could have dug through them to figure it out. But I got tired of fighting it. Staying on Sierra was way, way easier.

But still, sad.

Constructible Classes

TDispatch (but only Guildhall startup constructs this)

 

Copyright © 1981-2021 Arthur W Cabral. All Rights Reserved. All referenced trademarks are the property of their respective owners. This site does not use cookies. This site does not collect visitor information. The ISP hosting this site collects statistics regarding visitors to this site as part of the normal operation of the website. We do not currently examine those statistics. If that changes, this notice will change. Mac and macOS are registered trademarks of Apple, Inc. Sucky phone OS ought to be somebody's trademark, but likely isn't.