TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mikko Hyvarinen
from: Herbert Rosenau
date: 1996-08-24 13:37:20
subject: OS/2, Watcom 10.0, threads & stacks

Hi Mikko,

 MH> Question 1: if I start a thread like this...

 MH> stack = (char *) malloc(STACK_SIZE); tid = _beginthread(child, stack,
 MH> STACK_SIZE, args);

In OS/2 2.x and newer you don't have to alloc the stack by your own code.
In OS/2 2.0, 2.1x and 3.0 (WARP) the parameter stackzize is always ignored.
In OS/2 4.0 the parameter stacksize is optional.

Independant of that: YOU must free() the memory you malloc()ed at the right point.

Independant of that: OS/2 frees *all* resources your program requested.

 MH> ... do I have to free the stack myself or does the runtime library do
 MH> it?

ou should do it. 

 MH> Question 2: Can I use the thread ID's returned by _beginthread with the
 MH> OS/2 DosWaitThread call?

Yes.


Tschau/Bye

Herbert
	Member #53 of Team/OS2 Germany

Ab 14. 8. 96 neue Rufnummer: 49-7273-93072  (ISDN + analog)


--- Sqed/32 1.12.1/r00196
* Origin: Schont die Umwelt: Vermeidet DOSen (2:2476/493)
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: 2476/493 450 2 2452/110 2433/225 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™.