Xojo array of controls8/1/2023 ![]() ![]() ![]() ![]() You can use this feature to dynamically create any kind of control based on the RectControl class.Yes, this is all about the Control Set!īefore we put our hands on it, let’s make some things clear about the Control Set: If you think you need preemptive threads today, try the helper application approach and I think you’ll be pleasantly surprised at how well it works.Īdmit it – this is one of those questions that, sooner or later, arise to every Xojo newcomer: How can I add new UI controls to the Window at runtime? And if you are considering this too, then the good news is that the answer is more simple than you probably expect… sitting right there on the Inspector under the Attributes tab. Last but not least, you can run as many instances of these helper applications as your computer (or all the computers available to you) can run. And you can use the entire framework that is available to console applications. You don’t have to use lots of mutexs or sempahores to block other threads from altering things when you least expect them. But you don’t have to worry about variables changing mysteriously because some other thread changed the value. You have to design the communications between the main and helper applications. You have to think about what portion of your application can be segmented out into a helper console application. You don’t have to worry about the framework being thread safe as the helper and main application run as completely separate processes with their own memory space. ![]() You can use any data in either program in the same way you always have. The upside to this way of solving the problem is you can design and implement the main application and the helpers independently and use the debugger to debug each independently. The main application and the helpers can communicate in any one of several ways: IPCSockets, TCPSockets, UDPSockets, XML, files, or just about any other way you can dream of. The design is to create a main application (GUI or not) and use other helper applications to run separate tasks. There’s been a way to do this for as long as Xojo has supported building console applications. The end goal is to use all cores and thereby make your software more responsive, faster, or able to handle more data, or do more things all at the same time. It’s just not simple or easy to use the way most of Xojo is designed to be. That’s very different than what you have to do today and a lot more work. This would mean protecting any globals and pretty much anything that is not local to the method or the thread being executed. But you have to protect every place you might set a value that could be shared by many threads. The Xojo language already has functions like mutex and semaphores that help you make a multi-threaded program. We have had to go to a lot of extra work just to make the threads you have today work without causing problems. If you access something from a pre-emptive thread and that something is not thread-safe, there’s a very good chance your application is going to crash. Much of the framework would need updating to be thread safe and your application’s user interface is not thread safe on any platform because the operating systems themselves don’t have thread-safe user interface code. Some languages, like Java, have language features built in to them to try and help make this less work, but it is still hard to get right and very hard to debug when you don’t. It’s hard for you, the developer, to work with preemptive threads. Let’s look at why the current threads are not preemptive. Just make threads preemptive (so that they will then run on any available core) and voila! Unfortunately, it’s not that simple. It’s been suggested that this should be easy to do. We get a lot of requests for preemptive threads so that people can take advantage of multiple cores. If you have a lot of data to process, large images to manipulate or other things that could happen in the background, it would seem that with a multi-core machine you could do this faster “if only Xojo would make threads preemptive”. With today’s multi-core CPU’s it seems that an application made with Xojo running on a single core is somewhat restricting. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |