Skip to content

Commit

Permalink
Free resources in pthread_join
Browse files Browse the repository at this point in the history
  • Loading branch information
kimushu committed Oct 31, 2017
1 parent a568889 commit 7736e4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion TINYTH/src/tth_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,15 @@ int pthread_join(pthread_t thread, void **retval)
*retval = target->shared.retval;
}

tth_cs_move(&target, &tth_detach, TTHREAD_WAIT_DEAD);
tth_cs_end(lock);
#ifdef TTHREAD_MALLOC_LOCK
__malloc_lock(_impure_ptr);
#endif
free(target->autostack);
#ifdef TTHREAD_MALLOC_LOCK
__malloc_unlock(_impure_ptr);
#endif
return 0;
}

tth_cs_end(lock);
Expand Down
2 changes: 1 addition & 1 deletion tinythreads_sw.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set_sw_property display_name "TinyThreads"
set_sw_property extends_bsp_type HAL

# The version of this software
set_sw_property version 1.0
set_sw_property version 1.1

# Localtion in generated BSP
set_sw_property bsp_subdirectory TINYTH
Expand Down

0 comments on commit 7736e4c

Please sign in to comment.