Since a process in OS/2 owns data resources, window handles are available to any threads under the control of that process. It is therefore possible for a secondary thread to post a message to the window procedure that invoked it, advising that the secondary thread has completed its processing. The window procedure may then process the message and take appropriate action.
This technique may be used by secondary threads that use object windows and those which do not. It requires only that the secondary thread have addressability to the window handle of the window procedure that invoked it. This handle may be obtained directly from Presentation Manager, but it is recommended that the handle of the invoking window procedure is passed to the secondary thread upon invocation. This may be done in one of two ways:
The second method described above is illustrated in Figure "Synchronization Using Presentation Manager Messages".
Where the two communicating windows are under the control of different processes, the window handles must be explicitly communicated from one to the other since by default, the window handle of a window in one process is not available to a window in another process. One technique for achieving this communication involves passing the window handle of the first window when the second process is created, and having the second window return a message to the first window after initialization, containing the window handle of the second window. This technique allows both communication and synchronization between windows. An example is given in Creating Another Process.