aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_warp_level.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-06 22:10:16 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-06 22:10:16 +0100
commit079a4b6e9389b05db2c672594cfb2f2b197e35dd (patch)
treef4a2bc882dd7667e2c9758e2be38e3484879e225 /src/ft_warp_level.c
parentqwe (diff)
parentokok (diff)
download42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.gz
42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.bz2
42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.xz
42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.zst
42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.zip
Merge branch 'fork-music'
Diffstat (limited to 'src/ft_warp_level.c')
-rw-r--r--src/ft_warp_level.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 808b346..37789a5 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -15,13 +15,15 @@
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
-#include <mlx.h>
+#include <unistd.h>
#include <signal.h>
-#include <pthread.h>
+#include <sys/wait.h>
+#include <mlx.h>
static void
ft_del_map(t_map *ml)
{
+ ft_memdel((void**)&ml->filename);
ft_memdel((void**)&ml->no_tex_path);
ft_memdel((void**)&ml->so_tex_path);
ft_memdel((void**)&ml->ea_tex_path);
@@ -33,6 +35,7 @@ static void
ft_memdel((void**)&ml->music_cmd);
ft_memdel((void**)&ml->mapl);
ft_free_words(ml->map);
+ ft_free_words(ml->mcmd_words);
}
static void
@@ -66,16 +69,16 @@ static void
{
if (isoldmus && !cl->mlist.ismusic)
{
- pthread_cancel(cl->tid);
- pthread_join(cl->tid, NULL);
+ kill(cl->mpid, SIGTERM);
+ wait(&cl->mpid);
cl->isoldmus = 0;
}
else if (isoldmus && cl->mlist.ismusic
&& ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1))
{
- pthread_cancel(cl->tid);
- pthread_join(cl->tid, NULL);
- pthread_create(&cl->tid, NULL, ft_music_thread, cl);
+ kill(cl->mpid, SIGTERM);
+ wait(&cl->mpid);
+ ft_enable_music(cl);
}
else if (isoldmus && cl->mlist.ismusic
&& !ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1))