The example wasn't fully implemented the intention - it didn't work as expected when the trap/proc_exit was executed on the main thread, because main thread never waited for all the threads to start.