diff options
| author | John Birrell <jb@FreeBSD.org> | 1999-08-20 12:17:09 +0000 |
|---|---|---|
| committer | John Birrell <jb@FreeBSD.org> | 1999-08-20 12:17:09 +0000 |
| commit | e4065e8294ff8c282af0f945b19542cd28ac18db (patch) | |
| tree | b24e2c3a2122e83e264871b462a222550c0e0974 | |
| parent | 7a4acb8075c979c39646b6e812a5b5c5a1ac5357 (diff) | |
Notes
| -rw-r--r-- | lib/libc_r/uthread/uthread_fork.c | 29 | ||||
| -rw-r--r-- | lib/libkse/thread/thr_fork.c | 29 | ||||
| -rw-r--r-- | lib/libpthread/thread/thr_fork.c | 29 |
3 files changed, 69 insertions, 18 deletions
diff --git a/lib/libc_r/uthread/uthread_fork.c b/lib/libc_r/uthread/uthread_fork.c index 8ef8a3c9ce8d..f2e352c210dd 100644 --- a/lib/libc_r/uthread/uthread_fork.c +++ b/lib/libc_r/uthread/uthread_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); diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c index 8ef8a3c9ce8d..f2e352c210dd 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); diff --git a/lib/libpthread/thread/thr_fork.c b/lib/libpthread/thread/thr_fork.c index 8ef8a3c9ce8d..f2e352c210dd 100644 --- a/lib/libpthread/thread/thr_fork.c +++ b/lib/libpthread/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); |
