Release messaging sockets and context on shutdown (#1391)

* release resources when thread is done

* add white space

* add white space

Co-authored-by: deanlee <deanlee3@gmail.com>
pull/1394/head
Willem Melching 2020-04-17 16:37:34 -07:00 committed by GitHub
parent 3e2e241a38
commit 02e474580e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 5 deletions

View File

@ -632,6 +632,9 @@ void *can_send_thread(void *crap) {
while (!do_exit) {
can_send(subscriber);
}
delete subscriber;
delete context;
return NULL;
}
@ -662,6 +665,9 @@ void *can_recv_thread(void *crap) {
next_frame_time += dt;
}
delete publisher;
delete c;
return NULL;
}
@ -677,6 +683,9 @@ void *can_health_thread(void *crap) {
can_health(publisher);
usleep(500*1000);
}
delete publisher;
delete c;
return NULL;
}
@ -911,6 +920,8 @@ void *pigeon_thread(void *crap) {
cnt++;
}
delete publisher;
delete context;
return NULL;
}

View File

@ -67,6 +67,6 @@ int main() {
close(timerfd);
delete clock_publisher;
delete context;
return 0;
}

View File

@ -731,7 +731,8 @@ int main(int argc, char** argv) {
for (auto s : socks){
delete s;
}
delete poller;
delete s.ctx;
return 0;
}

View File

@ -94,7 +94,7 @@ int main(int argc, char **argv) {
visionstream_destroy(&stream);
delete dmonitoring_sock;
delete dmonstate_sock;
delete msg_context;
dmonitoring_free(&dmonitoringmodel);
return 0;

View File

@ -85,7 +85,10 @@ void* live_thread(void *arg) {
}
}
delete live_calibration_sock;
delete poller;
delete c;
return NULL;
}
@ -236,7 +239,10 @@ int main(int argc, char **argv) {
visionstream_destroy(&stream);
delete model_sock;
delete posenet_sock;
delete pathplan_sock;
delete msg_context;
model_free(&model);
LOG("joining live_thread");