Programming Guide:xppguide

Mastering Multi-threaded Programs Foundation

This chapter gives you the knowledge to effectively use multiple threads in your programs and to take full advantage of multi-threading. As you know, multi-threading is a key feature of 32-bit operating systems and every developer who can master this technology not only makes their life easier but has an enormous advantage. If you use multi-threading wisely, you can produce user-friendly applications which include features that will answer your (future) customer's question whether "to buy or not to buy" your software. If you have previously used multi-threading in other programming languages, try to forget how frustrating and complicated this process was. This chapter discusses typical problems associated with multi-threading and provides elegant solutions for multi-threading.

Multi-threading is known to be complicated in other programming languages, but with Xbase++ you have this feature at your finger tips. There are many things you don't need to care about - because Xbase++ does them for you. You can use multiple threads right out of the box without problems. However, you will need to be somewhat familiar with the concept of multi-threading to avoid improper use of program logic required when different parts of a program run in different threads at the same time.

The classical example of multi-threading is a program that lets a user enter data while a print job is being processed in the background at the same time. There is no problem if data entry and printing is implemented in two threads. But there are more exciting examples where multiple threads are useful, such as animation, tooltips, agents, watchdogs or incremental search in browsers, just to name a few. What would you think if an application reminds you five minutes in advance that you have an appointment with your boss at 4:15pm while you are concentrating on other tasks at your desk or computer. Of course, there are products specialized for this task, but wouldn't your customers appreciate this feature without having such a specialized product? If you know how to do it, you can add such a feature to your application in less than 2 hours using Xbase++. The major task of this chapter is to explain program logic required in multi-threading and to open the tremendous possibilities for solving common programming problems by using multiple threads.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.