Fix build --with-valgrind broken by scope thread rework.

The scope thread rework broek --with-valgrind builds due to the
different handling of the list of threads. Rework valgrind enabled
handling of the thread set within a scope.
This commit is contained in:
Stephen Williams 2010-01-09 10:38:24 -08:00
parent a919ee385d
commit 2638cd9f6e
3 changed files with 8 additions and 15 deletions

View File

@ -62,7 +62,7 @@ static void delete_sub_scopes(struct __vpiScope *scope)
case vpiNamedBegin:
case vpiNamedFork:
delete_sub_scopes(lscope);
vthreads_delete(lscope->threads);
vthreads_delete(lscope);
delete (scope->intern)[idx];
break;
case vpiIntegerVar:
@ -103,7 +103,7 @@ void root_table_delete(void)
for (unsigned idx = 0; idx < vpip_root_table_cnt; idx += 1) {
struct __vpiScope *scope = (__vpiScope *)vpip_root_table_ptr[idx];
delete_sub_scopes(scope);
vthreads_delete(scope->threads);
vthreads_delete(scope);
delete scope;
}
free(vpip_root_table_ptr);

View File

@ -455,20 +455,13 @@ static void child_delete(vthread_t base)
}
#endif
void vthreads_delete(vthread_t base)
void vthreads_delete(struct __vpiScope*scope)
{
if (base == 0) return;
vthread_t cur = base->scope_next;
while (base != cur) {
vthread_t tmp = cur->scope_next;
// if (cur->waiting_for_event) wait_next_delete(cur->wait_next);
// child_delete(cur->child);
delete cur;
cur = tmp;
for (std::set<vthread_t>::iterator cur = scope->threads.begin()
; cur != scope->threads.end() ; cur ++) {
delete *cur;
}
/* This is a stub so does not have a wait_next queue. */
delete base;
scope->threads.clear();
}
#endif

View File

@ -52,7 +52,7 @@ extern void thread_vthr_delete(struct __vpiHandle *item);
extern void thread_word_delete(struct __vpiHandle *item);
extern void vpi_call_delete(struct __vpiHandle *item);
extern void exec_ufunc_delete(vvp_code_t euf_code);
extern void vthreads_delete(vthread_t base);
extern void vthreads_delete(struct __vpiScope*scope);
extern void vvp_net_delete(vvp_net_t *item);
extern void pool_local_net(vvp_net_t *net);