TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jonathan de Boyne Pollard
from: Phil Crown
date: 1995-11-29 21:38:30
subject: Thereby Ends A Thread

-=> Quoting Jonathan de Boyne Pollard to Phil Crown <=- 

 JdBP> Why not use a termination queue like the rest of us ?

That's what I'm doing (now).

 JdBP> Incidentally, _endthread() is redundant just before the return from
 JdBP> a thread procedure.

Thanks, I didn't know that.

 JdBP> The flaw was twofold.  Firstly, the DosExitCritSec() was never being
 JdBP> called, and destructors for local objects were not being run, since
 JdBP> _endthread() never returns.  Secondly, there are many operations
 JdBP> that shouldn't be performed in critical sections, including anything
 JdBP> to do with Presentation Manager messages and message queues.

 JdBP> Morals ?

 JdBP> Don't use _endthread() at the end of a thread procedure, especially
 JdBP> if you use C++.

Seems like _endthread() would be ok if it is the very last thing called in
the procedure.  I'm grepping the RTL source for _endthread right now to see
what else I can find.  I don't use C++ so I'm not worried about that.

 JdBP> Don't use critical sections as a quick hack workaround (which is
 JdBP> what I later found out that this was), because they bite.  I'd put
 JdBP> them right up there in the hall of infamy display case alongside
 JdBP> Peter's DosSuspendThread and DosKillThread.

Will do... :-) thanks!

phil.crown{at}bluecafe.com

--- Blue Wave/Max v2.22b
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 214-250-4479 * (1:124/1208)
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: 124/1208 1 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™.