How to develop Multithreaded applications with PowerBuilder - Questions and Answers from the webinar
- PowerBuilder News
- Hits: 14746
During this webinar, we will build multithreaded applications (with versions prior to PowerBuilder 12) so that they can be run as separate processes in order to maximize processor and memory usage. We will also explain the new features and advantages of doing multithreaded development in PowerBuilder 12.5 using PowerBuilder .NET functions.
?
Presenter: Bruce Armstrong
?
Q: Is there a way to have threads communicate with each other or does communication have to go through the main thread?
A:? Communication should go through the main thread as the child threads have no knowledge of each other, just of the parent thread (the UI thread).? If you want to have child threads coordinate, you can either pass the info back to the main thread or have another mechanism (e.g., data in the database) that helps them communicate.
Q: Is multithreading only appropriate for standalone background processing that doesn't interact with the user interface other than instance and global variables.
A: The child threads should not interact with the user interface directly.? They can pass back information to the main (UI) thread and have the main thread display the information to the user through the user interface.? The child threads should not attempt to do that directly.? The child threads do not have access to instance or global variables of the main thread.
Multithreading is largely used when you do not want the main thread to be tied up waiting for the completion of an operation.? It may be a long running operation or it may be a series of shorter running independent operations that you want to run concurrently rather than sequentially.
Q: How do you handle failures a thread in the main thread?
A: Pass error information back to the UI thread via the object reference used to pass data back.
Q: In each thread how do you make sure the files does not have duplicate file names.
A: In the code samples?? The name of the file to write was passed in as an argument.
Find more Questions and Answers on PowerBuilderTV