Synchronization Using Presentation Manager Messages

        :
case WMP_THREAD:                        /* Start secondary thread       */
     DosCreateThread(ThreadID,          /* Thread ID                    */
                     Thread,            /* Entry point for thread       */
                     (PVOID)hwnd,       /* Invoking window handle       */
                     0L,                /* Start immediately            */
                     4096);             /* Stack size for thread        */
     break;

case WMP_ENDOFTHREAD:                   /* Thread has completed         */

     <perform end-of-thread processing>

     break;
        :
        :
int cdecl thread(hReturn)               /* Thread routine               */
    HWND hReturn;                       /* Handle of calling window     */
{
    <Perform lengthy processing task>

    WinPostMsg(hReturn,                 /* Post message to caller       */
               WMP_ENDOFTHREAD,         /* Message class                */
               0,0);                    /* No parameters                */
    DosExit(EXIT_THREAD,                /* Terminate thread             */
            0L);
}


[Back: Interprocess Communication Using Named Pipes (Part 2)]
[Next: Synchronization Using an Event Semaphore (Part 1)]