summaryrefslogtreecommitdiff
path: root/ports/unix/main.c
diff options
context:
space:
mode:
authorMikhail Zakharov <mikhail.zakharov@cognitivesystems.com>2019-01-02 10:05:17 -0500
committerDamien George <damien.p.george@gmail.com>2019-01-27 12:38:23 +1100
commitf8c1be85d1d80fae4b71634a411ab354756c3bda (patch)
treeba28dbf2239dadd7910b24dea8c4ee9d3d153516 /ports/unix/main.c
parentc7ed17bc4bb6127d7b6db841b453462f4ba96514 (diff)
unix/mpthreadport: Add thread deinit code to stop threads on exit.
Free unused memory for threads and cancel any outstanding threads on interpreter exit to avoid possible segmentaiton fault.
Diffstat (limited to 'ports/unix/main.c')
-rw-r--r--ports/unix/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c
index 1cf237a2b..8d455fa83 100644
--- a/ports/unix/main.c
+++ b/ports/unix/main.c
@@ -647,6 +647,10 @@ MP_NOINLINE int main_(int argc, char **argv) {
}
#endif
+ #if MICROPY_PY_THREAD
+ mp_thread_deinit();
+ #endif
+
#if defined(MICROPY_UNIX_COVERAGE)
gc_sweep_all();
#endif