aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_exit.c13
-rw-r--r--src/ft_music.c5
-rw-r--r--src/ft_treat_args.c2
-rw-r--r--src/ft_warp_level.c2
4 files changed, 5 insertions, 17 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index 40860e7..a19bff3 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -43,9 +43,6 @@ static void
int
ft_exit(uint8_t exit_code, t_cub *clist)
{
- uint8_t ismus;
- pthread_t ttid;
-
if (clist->walltexgood)
{
if (clist->tlist[0].img)
@@ -66,14 +63,12 @@ int
mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr);
clist->wlist->winptr = NULL;
}
- ismus = clist->mlist->ismusic;
- ttid = clist->tid;
- ft_free_lists(clist);
- if (ismus)
+ if (clist->mlist->ismusic)
{
- pthread_cancel(ttid);
- pthread_join(ttid, NULL);
+ pthread_cancel(clist->tid);
+ pthread_join(clist->tid, NULL);
}
+ ft_free_lists(clist);
ft_printf("Exiting program\n");
exit(exit_code);
return (0);
diff --git a/src/ft_music.c b/src/ft_music.c
index 8006928..5eed915 100644
--- a/src/ft_music.c
+++ b/src/ft_music.c
@@ -26,8 +26,3 @@ void
system(cl->mlist->music_cmd);
return (NULL);
}
-
-/* void */
-/* *ft_hooks_thread(void *vargp) */
-/* { */
-/* } */
diff --git a/src/ft_treat_args.c b/src/ft_treat_args.c
index dab29ac..6f8ef87 100644
--- a/src/ft_treat_args.c
+++ b/src/ft_treat_args.c
@@ -38,9 +38,7 @@ uint8_t
return (ft_exit(FT_RET_FAILED_MLX, clist));
ft_draw_scene(clist);
if (clist->mlist->ismusic)
- {
pthread_create(&clist->tid, NULL, ft_music_thread, clist);
- }
ft_hooks_and_loops(clist->wlist, clist);
}
else if (argc == 3 && !ft_strncmp("--save", argv[2], 7))
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 866bd69..41d1a45 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -62,7 +62,7 @@ static void
if (cl->mlist->ismusic)
{
pthread_cancel(cl->tid);
- pthread_exit(NULL);
+ pthread_join(cl->tid, NULL);
}
}