diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 15:09:59 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 15:09:59 +0100 |
commit | 163bed0c8988ff020b746bf96dc01dd2058dc4f9 (patch) | |
tree | 724090f6319cc6d0336eb2a5b501bd032599d295 /src/ft_exit.c | |
parent | ok (diff) | |
download | 42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.gz 42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.bz2 42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.xz 42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.zst 42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.zip |
Footsteps are bav
Diffstat (limited to '')
-rw-r--r-- | src/ft_exit.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c index 625f86b..c3b5ebf 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -15,10 +15,8 @@ #include <mlx.h> #include <stddef.h> #include <stdlib.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> #include <stdint.h> +#include <pthread.h> static void ft_free_lists(t_cub *clist) @@ -39,6 +37,9 @@ static void ft_memdel((void**)&clist->mlist.mapl); ft_free_words(clist->mlist.map); ft_memdel((void**)&clist->sfx.death); + ft_memdel((void**)&clist->sfx.footstep_one); + ft_memdel((void**)&clist->sfx.footstep_two); + ft_memdel((void**)&clist->sfx.new_lvl); ft_memdel((void**)&clist->sfx.pain_one); ft_memdel((void**)&clist->sfx.pain_two); ft_memdel((void**)&clist->sfx.trap); @@ -72,7 +73,7 @@ static void } static void - ft_kill_forks(t_cub *clist) + ft_cancel_threads(t_cub *clist) { if (clist->isoldmus && clist->wlist.inited) { @@ -82,12 +83,15 @@ static void pthread_mutex_unlock(&clist->sfx.death_mutex); pthread_cancel(clist->sfx.death_tid); pthread_join(clist->sfx.death_tid, NULL); - pthread_mutex_unlock(&clist->sfx.pain_mutex); - pthread_cancel(clist->sfx.pain_tid); - pthread_join(clist->sfx.pain_tid, NULL); + pthread_mutex_unlock(&clist->sfx.footstep_mutex); + pthread_cancel(clist->sfx.footstep_tid); + pthread_join(clist->sfx.footstep_tid, NULL); pthread_mutex_unlock(&clist->sfx.new_lvl_mutex); pthread_cancel(clist->sfx.new_lvl_tid); pthread_join(clist->sfx.new_lvl_tid, NULL); + pthread_mutex_unlock(&clist->sfx.pain_mutex); + pthread_cancel(clist->sfx.pain_tid); + pthread_join(clist->sfx.pain_tid, NULL); pthread_mutex_unlock(&clist->sfx.trap_mutex); pthread_cancel(clist->sfx.trap_tid); pthread_join(clist->sfx.trap_tid, NULL); @@ -105,7 +109,7 @@ int mlx_destroy_window(clist->wlist.wlx, clist->wlist.winptr); clist->wlist.winptr = NULL; } - ft_kill_forks(clist); + ft_cancel_threads(clist); ft_free_lists(clist); ft_printf("Exiting program\n"); exit(exit_code); |