diff options
Diffstat (limited to 'lib/libkse/thread/thr_fork.c')
-rw-r--r-- | lib/libkse/thread/thr_fork.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c index 8ef8a3c..f2e352c 100644 --- a/lib/libkse/thread/thr_fork.c +++ b/lib/libkse/thread/thr_fork.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_fork.c,v 1.10 1999/06/20 08:28:23 jb Exp $ + * $Id: uthread_fork.c,v 1.11 1999/08/05 12:15:11 deischen Exp $ */ #include <errno.h> #include <string.h> @@ -131,11 +131,28 @@ fork(void) if (pthread_save->attr.stackaddr_attr == NULL && pthread_save->stack != NULL) - /* - * Free the stack of the - * dead thread: - */ - free(pthread_save->stack); + if (pthread_save->attr.stacksize_attr + == PTHREAD_STACK_DEFAULT) { + /* + * Default-size stack. Cache + * it: + */ + struct stack *spare_stack; + + spare_stack + = (pthread_save->stack + + PTHREAD_STACK_DEFAULT + - sizeof(struct stack)); + SLIST_INSERT_HEAD( + &_stackq, + spare_stack, + qe); + } else + /* + * Free the stack of + * the dead thread: + */ + free(pthread_save->stack); if (pthread_save->specific_data != NULL) free(pthread_save->specific_data); |