Message-Id: <200006202002.XAA00101@alpha.netvision.net.il> Date: Tue, 20 Jun 2000 23:05:06 +0200 X-Mailer: Emacs 20.6 (via feedmail 8.1.emacs20_6 I) and Blat ver 1.8.5b From: "Eli Zaretskii" To: Cherniavsky Beni CC: djgpp AT delorie DOT com In-reply-to: <394F7CEF.C3B04F13@crosswinds.net> (message from Cherniavsky Beni on Tue, 20 Jun 2000 16:17:19 +0200) Subject: Re: multitasking/threading in DJGPP References: <394F7CEF DOT C3B04F13 AT crosswinds DOT net> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Cherniavsky Beni > Newsgroups: comp.os.msdos.djgpp > Date: Tue, 20 Jun 2000 16:17:19 +0200 > > Isn't there a way to check at run-time with what size of stack the > program is configured? Yes, there is: look at the value of _stklen. > The idea is that the library should allocate > more stack per thread in programs needing much stack space. What library? the DJGPP standard library, libc.a? I don't think it's library's business to decide how much stack to allocate. It doesn't have enough information for that, not in the startup code anyway. > It would be nicer if > the startup code updated _stklen with the actual value it used. It does; please try it and tell if it doesn't work for you. (The startup code in crt0.S clearly updates _stklen with the actual value.) > Anyway a better solution might be to allow the stack size for the > thread as a parameter when creating a thread. That won't help: the stack of a DJGPP program is allocated in its entirety during startup, and its size cannot be changed later. So the maximum stack size must be determined statically at compile time, or changed by STUBEDIT.