Annotation of q_a/samples/termq/readme.txt, revision 1.1.1.1

1.1       root        1:  Sample: Porting a DosStartSession Termination Queue
                      2: 
                      3: Summary:
                      4: 
                      5: This sample code demonstrates how to start multiple
                      6: processes and wait on them to terminate. It also
                      7: demonstrates how to convert the OS/2 method of reading from
                      8: a "termination queue" to the equivalent Win32 API function
                      9: calls.
                     10: 
                     11: In the sample, a number of child processes are started. The
                     12: program then waits for any of them to end via the Win32
                     13: WaitForMultipleObjects function call. As soon as a process
                     14: terminates, the return code for the terminated process is
                     15: retrieved and reported to the console.
                     16: 
                     17: More Information:
                     18: 
                     19: After starting child sessions with DosStartSession in OS/2,
                     20: if you want to be notified when the child sessions
                     21: terminate, you must create a queue and pass the handle to
                     22: that queue into the DosStartSession call. When a child
                     23: session ends, you receive a queue packet containing
                     24: information about which session (by session ID) ended and
                     25: what the termination code of that session is.
                     26: 
                     27: A major limitation of this method is that you are allowed
                     28: only one termination queue per parent; this imposes some
                     29: complications with multiple-threaded applications starting
                     30: multiple sessions in different threads; you cannot have
                     31: multiple threads reading from the same termination queue at
                     32: the same time. The common solution is to have one central
                     33: termination queue thread that reads from the termination
                     34: queue (all of the child sessions's termination packets
                     35: arrive in this one Queue), and process all of the
                     36: termination queue packets for all of the other threads.
                     37: 
                     38: Under Win32, this complication is not there. Each thread
                     39: that starts a new session simply waits for the new process
                     40: handle to be signaled.
                     41: 
                     42: This demonstration does not involve multiple threads, nor
                     43: does it demonstrate the complexity of the OS/2 version of
                     44: multiple threads waiting for multiple sessions to terminate.
                     45: It demonstrates the more simple case of starting a few
                     46: sessions and waiting for all of them to end; the Win32
                     47: technique used is still fully demonstrated without including
                     48: a great deal of OS/2 code.
                     49: 
                     50: The following is a list of the Win32 API functions used in
                     51: this sample:
                     52: 
                     53:    CloseHandle   CreateProces  GetLastErro  WaitForMultipleOb
                     54:                  s             r            jects
                     55: 
                     56: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.