Maintaining Synchronization

It is the responsibility of the application to ensure the appropriate level of synchronization between threads or process accessing resources. Assuming the convention suggested in Threads Without Object Windows, it is only necessary to indicate when a secondary thread or process has completed processing a particular unit of work. This may be achieved in a number of ways:

  • By having the secondary thread or process post a completion message to the calling window procedure before terminating

  • By using an event semaphore in conjunction with the Presentation Manager timer facility

  • By using the DosWaitThread() function in the case of threads

  • By using the DosWaitChild() function in the case of processes.

    While it is possible, when using object windows in secondary threads or separate processes, to ensure synchronization by using the WinSendMsg() call for synchronous processing of the target window procedure, this method is not recommended since it prevents the calling window procedure from processing additional user input, and is thus potentially in violation of SAA CUA guidelines. In addition, immediate invocation of a window procedure in this way may disturb the natural sequence of message processing and compromise the user's intention.


    [Back: Pipes]
    [Next: Presentation Manager Messages]