TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Phil Crown
from: Peter Fitzsimmons
date: 1995-11-15 02:32:08
subject: waiting on a session

PC>   rc = DosSuspendThread(pdata->tidReadThread);

DosSuspendThread is not a good idea.  Use a semaphore instead; this way
your read thread will block in a controlled place.

 PC> VOID    WaitForSession(PTID ptid, ULONG SessID)

You're right to ask for advice...use a termination queue instead.  Here is
a (16bit) sample (I wrote this program before the START command became
flexible):


 #define INCL_NOPM
 #define INCL_DOS
 #define INCL_DOSERRORS
 #include 
 #include 
 #include 
 #include 
 #include 

 void showuse(void)
 {
    
printf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n");
     printf("X DSS       (DosStartSession)       P.Fitzsimmons
91/09/02 X\n");
     printf("X                                             Version
0.00 X\n");
     printf("X Usage:   DSS [options]  [program
arguments] X\n");
     printf("X Purpose:  Start a new session.                         
 X\n");
     printf("X Options:  /F    - Switch program to foreground.        
 X\n");
     printf("X           /WIN  - Run in a VIO window session.         
 X\n");
     printf("X           /FS   - Run in a full screen session.        
 X\n");
     printf("X           /PM   - Run as a PM program.                 
 X\n");
     printf("X           /WAIT - Wait for program to complete (default
 X\n");
     printf("X                   is asynchronus)                      
 X\n");
    
printf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n");
 }

 typedef struct _qstart {
     USHORT pidSession;
     USHORT pidProcess;
     USHORT pidParentSession;
     USHORT pidParentProcess;
 }QSTART;

 typedef struct _qdie {
     USHORT pidSession;
     USHORT retcode;
 }QDIE;

 void cdecl main(int argc, char **argv)
 {
     PID pidSession;
     PID pidProcess;
     STARTDATA startdata;
     static char parms[256];
     static char pgm[_MAX_PATH];
     USHORT rc;
     int i;
     USHORT SessionType = 0;
     BOOL back = TRUE;
     BOOL wait = FALSE;
     HQUEUE hq;
     char qname[30];
     QUEUERESULT qr;
     USHORT len;
     BYTE prty;
     QSTART far *pv;
     QDIE   far *qd;

     if (argc == 1){
         showuse();
         exit(1);
     }

     rc = 0;
     for(i=1; (int)ipidSession, qd->retcode);
                 break;
             }
         }while(1);
         if(rc)
            printf("error 0x%04x\n", rc);
     }
     exit(0);
 }

--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.