🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #3136

Re: Recovering a Dead Thread's Stack, etc.

#3136
From: larrys
Date: Tue, 21 May 1991 14:19
33 lines
2085 bytes
In <24884@well.sf.ca.us>, shiva@well.sf.ca.us (Kenneth Porter) writes:
>
>How can I tell when a thread is dead and its resources
>(especially its stack) can be reclaimed?  Presumably the thread
>can't free its own stack since it needs it to call DosExit().
>One can't tell that a thread is dead by testing for its ID
>with, say, DosSuspendThread() (looking for the
>ERROR_INVALID_THREADID) since another thread might be created
>that would pick up a dying thread's ID.  Presumably
>_beginthread() accomplishes the stack reclamation, since my
>company has an application that spawns short-run threads left
>and right with it and it doesn't lose memory over time.
>
>Ken (shiva@well.sf.ca.us)

I don't know of a way to do this.  I had a rather large discussion with a
colleage yesterday about designing for multithreading.  I will be sending
a large posting with advantages/disadvantages of various multithreaded
programming techniques soon.

How do you know the application mentioned isn't losing memory?  Are you
using some sort of memory utility?

Cheers,
Larry Salomon, Jr. (aka 'Q')            LARRYS@YKTVMV.BITNET
OS/2 Applications and Tools             larrys@ibmman.watson.ibm.com
IBM T.J. Watson Research Center         larrys@eng.clemson.edu
Yorktown Heights, NY

Disclaimer:  The statements and/or opinions stated above are strictly my
own and do not reflect the views of my employer.  Additionally, I have a
reputation for being obnoxious, so don't take any personal attacks too
seriously.
Technical Details
Message-ID: <1991May21.132229.996@watson.ibm.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!sdd.hp.com!spool.mu.edu!uunet!bywater!arnor!ibmman!larrys
References: <24884@well.sf.ca.us>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!sdd.hp.com!spool.mu.edu!uunet!bywater!arnor!ibmman!larrys
From: larrys@watson.ibm.com
Newsgroups: comp.os.os2.programmer
Subject: Re: Recovering a Dead Thread's Stack, etc.
Message-ID: <1991May21.132229.996@watson.ibm.com>
Date: 21 May 91 14:19:22 GMT
References: <24884@well.sf.ca.us>
Sender: larrys@ibmman
Reply-To: larrys@ibmman
Distribution: comp
Organization: IBM Research
Lines: 33
News-Software: NewsKit 1.2 - LaMail
Nntp-Posting-Host: ibmman2