aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r--src/ft_exit.c26
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