Thread Communication

You can share data items among threads. This is the easiest form of communication among threads. The drawback to this form of data sharing is that you must carefully code the program so as to ensure that data is accessed and updated in a consistent manner. A second drawback is that there is no efficient way for one thread to wait for another to update a particular data item. You could arrange a set of data items to act as semaphores, but it is inefficient for a thread to loop until a data item reaches a particular value. It would be much better for the thread to sleep until the data item it needs is available.

To solve this problem, ACUCOBOL-GT provides a way for threads to send messages to each other. A message can be any data item. You decide in your program how you want to format messages.