![]() ![]() In this document we explore the solutions available to Gtk# developers to keep your GUI responsive by using multiple threads and other approaches. ![]() Threads are often used to overcome this problem, but as explained above you have to be careful when using them. There are a number of reasons why an application might become unresponsive to a user: the application might be performing a long-running computation or it might be blocking on data to become available from the network, a file system or the operating system. There are a number of approaches that can be used depending on the situation and the complexity of the computation. The solution is to turn the notification into an event that is then dispatched from the main thread.Ī common problem faced by GUI application developers is keeping an application responsive while a long-running operation is running. ![]() #Wait until responsive resize finishes redrawing the page update#This includes method calls and property access.Ī typical scenario is that your thread will want to update the user interface with some status progress or notify the user when a task is completed. The most important thing to keep in mind is that the thread running the Gtk main loop (the one that calls ()) is the only thread that should make calls into Gtk. Threads are useful if you need to perform long running computations or your application complexity would increase too much if it were event driven. Failure to restrict the use of Gtk to this thread will result in unpredictable behavior, and most often will lead to a crash. This means that all Gtk operations should be perfomed from this thread and no other thread. The thread that happens to run the event loop is said to "own" Gtk. The loop that processes and dispatches events is called the "event loop".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |