diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 14:26:29 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 14:26:29 +0100 |
commit | bcbe3db5345f86fcacb039039382f3130c933eea (patch) | |
tree | 36cb74b5e6d4c1b6ade5816ee821c58acbd4fd17 /src/ft_exit.c | |
parent | Character is now FAT (diff) | |
download | 42-cub3d-bcbe3db5345f86fcacb039039382f3130c933eea.tar.gz 42-cub3d-bcbe3db5345f86fcacb039039382f3130c933eea.tar.bz2 42-cub3d-bcbe3db5345f86fcacb039039382f3130c933eea.tar.xz 42-cub3d-bcbe3db5345f86fcacb039039382f3130c933eea.tar.zst 42-cub3d-bcbe3db5345f86fcacb039039382f3130c933eea.zip |
Sounds have been threaded
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r-- | src/ft_exit.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c index 3cd933a..625f86b 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -38,10 +38,10 @@ static void ft_memdel((void**)&clist->mlist.music_cmd); ft_memdel((void**)&clist->mlist.mapl); ft_free_words(clist->mlist.map); - ft_free_words(clist->sfx.death); + ft_memdel((void**)&clist->sfx.death); ft_memdel((void**)&clist->sfx.pain_one); ft_memdel((void**)&clist->sfx.pain_two); - ft_free_words(clist->sfx.trap); + ft_memdel((void**)&clist->sfx.trap); ft_free_sprites(clist->mlist.sprite_path); if (!clist->wlist.inited) ft_memdel((void**)&clist->wlist.winptr); @@ -74,23 +74,23 @@ static void static void ft_kill_forks(t_cub *clist) { - pid_t tmp; - if (clist->isoldmus && clist->wlist.inited) { pthread_cancel(clist->mtid); pthread_join(clist->mtid, NULL); } + 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); - if (!(tmp = waitpid(clist->sfx.death_pid, NULL, WNOHANG))) - kill(clist->sfx.death_pid, SIGTERM); - wait(&clist->sfx.death_pid); - if (!(tmp = waitpid(clist->sfx.new_lvl_pid, NULL, WNOHANG))) - kill(clist->sfx.new_lvl_pid, SIGTERM); - wait(&clist->sfx.new_lvl_pid); - if (!(tmp = waitpid(clist->sfx.trap_pid, NULL, WNOHANG))) - kill(clist->sfx.trap_pid, SIGTERM); - wait(&clist->sfx.trap_pid); + pthread_join(clist->sfx.pain_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.trap_mutex); + pthread_cancel(clist->sfx.trap_tid); + pthread_join(clist->sfx.trap_tid, NULL); } int |