@@ -141,6 +141,9 @@ Stats terminate(VM* vm) {
141 pthread_mutex_destroy(&(vm->alloc_lock));
141 pthread_mutex_destroy(&(vm->alloc_lock));
142 pthread_cond_destroy(&(vm->inbox_waiting));
142 pthread_cond_destroy(&(vm->inbox_waiting));
143 free(vm->inbox);
143 free(vm->inbox);
144+ if (vm->creator != NULL) {
145+ vm->creator->processes--;
145 // free(vm);
148 // free(vm);
146 // Set the VM as inactive, so that if any message gets sent to it
149 // Set the VM as inactive, so that if any message gets sent to it
@@ -801,7 +804,9 @@ void* runThread(void* arg) {
801 free(td);
804 free(td);
802 fn(vm, NULL);
805 fn(vm, NULL);
804− assert(0); // will not be reached
807+ // Stats stats =
809+ // aggregate_stats(&(td->vm->stats), &stats);
805 return NULL;
810 return NULL;
@@ -837,9 +842,6 @@ void* vmThread(VM* callvm, func f, VAL arg) {
839void* idris_stopThread(VM* vm) {
844void* idris_stopThread(VM* vm) {
840− if (vm->creator != NULL) {
841− vm->creator->processes--;
843 terminate(vm);
845 terminate(vm);
844 pthread_exit(NULL);
846 pthread_exit(NULL);
845 return NULL;
847 return NULL;