TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Burgett
from: Doug Nazar
date: 1996-09-17 23:52:14
subject: DosWaitThread

Hello Mike!

Monday September 16 1996 23:14, Mike Burgett wrote to All:

MB> Is a tid the result returned by _beginthread() or the
tib->> tib_ptib2->pib2_ultid ? Or can it only be obtained by using
MB> DosCreateThread instead of _beginthread ?

all of the above .

MB> The reason I ask, is that DosWaitThread doesn't seem to be waiting for
MB> a thread to exit in the first two cases, and I don't really want to
MB> recode just to test the third....

You didn't post any source but here's a little sample:

#include 
#include 

#define INCL_DOSPROCESS
#include 

extern "C"
   void Thread2(void*);

void Thread2(void*)
{
   cout << "Thread 2 started" << endl;

   DosSleep(10000);

   cout << "Thread 2 ending" << endl;
}

int main()
{
   APIRET rc = 0;
   TID threadId = _beginthread(Thread2, 0, 4096, 0);

   if (!threadId)
   {
      cerr << "_beginThread() failed" << endl;
      return 1;
   }

   rc = DosWaitThread(&threadId, DCWW_WAIT);
   if (rc)
      cerr << "DosWaitThread returned " << rc << endl;

   cout << "Ending..." << endl;

   return 0;
} 
MB> I'm using VageC++ with the following syslevels, if it makes any
MB> difference:

They shouldn't make any difference but FYI those are a bit
"dated" .

Doug

--- GoldED/2 3.00.Alpha1+
* Origin: Realm of the Dragons - `Where thy mind hath no limits' (1:250/516)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 250/516 101 99 3615/50 396/1 270/101 712/515 711/808 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™.