Thread synchronization

Sometimes one task must wait for another asks to finish before it can proceed. Consider a data acquisition application with 2 tasks: taskA that acquires data and taskB that displays data. taskB cannot display new data until taskA fills in a global data structure with all the new data values. taskA and taskB are typically synchronized as follows. (1) taskB waits for a message from taskA, and since no message is available, taskB suspends. When taskA runs and updates the data structure, it sends a message to taskB, which schedules taskB to run, at which time it displays the new data, then again waits for a message, and the scenario is repeated.