summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_kern.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2003-04-30 15:05:17 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2003-04-30 15:05:17 +0000
commitd143dde4381aa8a80b079f5f4fc8151ac9dd0abb (patch)
tree9350a8aef34768a87292c8deae80e7fc8f1af999 /lib/libpthread/thread/thr_kern.c
parent2c50682195b096c4717dbdd5b19b187f1447eb5e (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_kern.c')
-rw-r--r--lib/libpthread/thread/thr_kern.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index a153a4d7e737..54d9dd778b09 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/thread/thr_kern.c
@@ -2019,6 +2019,7 @@ struct pthread *
_thr_alloc(struct pthread *curthread)
{
kse_critical_t crit;
+ void *p;
struct pthread *thread = NULL;
if (curthread != NULL) {
@@ -2035,8 +2036,13 @@ _thr_alloc(struct pthread *curthread)
_kse_critical_leave(crit);
}
}
- if (thread == NULL)
- thread = (struct pthread *)malloc(sizeof(struct pthread));
+ if (thread == NULL) {
+ p = malloc(sizeof(struct pthread) + THR_ALIGNBYTES);
+ if (p != NULL) {
+ thread = (struct pthread *)THR_ALIGN(p);
+ thread->alloc_addr = p;
+ }
+ }
return (thread);
}
@@ -2052,7 +2058,7 @@ _thr_free(struct pthread *curthread, struct pthread *thread)
_lockuser_destroy(&thread->lockusers[i]);
}
_lock_destroy(&thread->lock);
- free(thread);
+ free(thread->alloc_addr);
}
else {
crit = _kse_critical_enter();