Use prof_tdata_cleanup() argument.

Use the argument to prof_tdata_cleanup(), rather than calling
PROF_TCACHE_GET().  This fixes a bug in the NO_TLS case.
This commit is contained in:
Jason Evans 2011-08-08 17:10:07 -07:00
parent 04ca1efe35
commit 41b954ed36

View File

@ -1109,7 +1109,6 @@ prof_tdata_init(void)
prof_tdata->vec = imalloc(sizeof(void *) * prof_bt_max); prof_tdata->vec = imalloc(sizeof(void *) * prof_bt_max);
if (prof_tdata->vec == NULL) { if (prof_tdata->vec == NULL) {
ckh_delete(&prof_tdata->bt2cnt); ckh_delete(&prof_tdata->bt2cnt);
idalloc(prof_tdata); idalloc(prof_tdata);
return (NULL); return (NULL);
@ -1127,33 +1126,29 @@ prof_tdata_init(void)
static void static void
prof_tdata_cleanup(void *arg) prof_tdata_cleanup(void *arg)
{ {
prof_tdata_t *prof_tdata; prof_thr_cnt_t *cnt;
prof_tdata_t *prof_tdata = (prof_tdata_t *)arg;
prof_tdata = PROF_TCACHE_GET(); /*
if (prof_tdata != NULL) { * Delete the hash table. All of its contents can still be
prof_thr_cnt_t *cnt; * iterated over via the LRU.
*/
ckh_delete(&prof_tdata->bt2cnt);
/* /*
* Delete the hash table. All of its contents can still be * Iteratively merge cnt's into the global stats and delete
* iterated over via the LRU. * them.
*/ */
ckh_delete(&prof_tdata->bt2cnt); while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) {
prof_ctx_merge(cnt->ctx, cnt);
/* ql_remove(&prof_tdata->lru_ql, cnt, lru_link);
* Iteratively merge cnt's into the global stats and delete idalloc(cnt);
* them.
*/
while ((cnt = ql_last(&prof_tdata->lru_ql, lru_link)) != NULL) {
prof_ctx_merge(cnt->ctx, cnt);
ql_remove(&prof_tdata->lru_ql, cnt, lru_link);
idalloc(cnt);
}
idalloc(prof_tdata->vec);
idalloc(prof_tdata);
PROF_TCACHE_SET(NULL);
} }
idalloc(prof_tdata->vec);
idalloc(prof_tdata);
PROF_TCACHE_SET(NULL);
} }
void void