-// pthread_detach(CAN_B_to_A_thread);\r
-// pthread_detach(CAN_A_to_B_thread);\r
+ /* detach is needed so that the threads call clean up handlers automatically. */\r
+ pthread_detach(CAN_B_to_A_thread);\r
+ pthread_detach(CAN_A_to_B_thread);\r
/* Not sure what to do with error here, will have to figure out later. */\r
}\r
printf("Attempting to stop thread 2\n");\r
res = pthread_cancel(CAN_B_to_A_thread);\r
if (res != 0){\r
/* Not sure what to do with error here, will have to figure out later. */\r
}\r
printf("Attempting to stop thread 2\n");\r
res = pthread_cancel(CAN_B_to_A_thread);\r
if (res != 0){\r