TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Andrew Graham
from: Phil Crown
date: 1995-06-15 13:56:40
subject: adding a thread

I don't know which compiler you're using, but it wouldn't compile under
Borland C++ for OS/2.  I made some fixes so that it will.  I think it is a
quirk in Borland's _beginthread(), it only accepts 3 parms, but under EMX I
have to pass 4 parms to _beginthread().  Here's the fixes... :-)

 void SpinThread(void *vpDie)
 {
     unsigned i=0;
     BYTE attr = 7;
     char c[4] = "-\\|/";
     int * volatile pDie = (int *)vpDie;

   //while(*pDie == FALSE){
     while( pDie == FALSE){   // was causing a SYSxxxx at runtime
         attr = column | ((row + 7) << 4);
         attr &= 0x7f;   /*PLF Tue  95-06-13 10:58:18*/
         VioWrtCharStrAtt(c+i, 1, column + COLUMN, row + ROW, &attr, 0);
         i++;
         if(i == sizeof(c))
             i = 0;
         DosSleep(50L);
     }
     printf("bye!\n");
 }

    [...]

   //_beginthread(SpinThread, NULL, 0x4000, &die);
     _beginthread(SpinThread, 0x4000, (void *)die); // BCOS/2

    [...]


Phil

--- Blue Wave/OS2 v2.20u Beta
* Origin: Crown Point (1:124/6108.2)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 124/6108 1014 1 396/1 270/101 105/103 42 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™.