Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rpi!ander From: ander@pawl.rpi.edu (Michael R. Primm) Newsgroups: comp.os.os2 Subject: Re: Threads and semaphores under OS/2 Keywords: OS/2 semaphores stacks threads Message-ID: <1989Oct25.010535.10167@rpi.edu> Date: 25 Oct 89 01:05:35 GMT References: <5154@uhccux.uhcc.hawaii.edu> <3732@dell.dell.com> <3981@helios.ee.lbl.gov> <1989Oct19.143604.21001@rpi.edu> <32054@ucbvax.BERKELEY.EDU> <105@bohra.cpg.oz> Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 13 For the stack allocation problem, one user solution I've though of may be the use of a "watchdog" thread. Each stack that you allocate for a thread would have a RAM semaphore associated with it which starts off being "set". When a threat possessing such a stack wishes to terminate, it "clears" the semaphore and exits. The one problem is being sure that the thread is able to exit before the stack gets reused. But, anyway, the watchdog would hang out waiting for stack semaphores to "clear", and would free the storage after a "reasonable delay" (long enough to be sure the thread was able to exit after the semaphore was cleared). Anyway, while its pretty kludgy, it may be a possible route to consider. --Mike Primm