aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_music.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_music.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_music.c')
-rw-r--r--src/ft_music.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/ft_music.c b/src/ft_music.c
index aec5e58..c3b90b1 100644
--- a/src/ft_music.c
+++ b/src/ft_music.c
@@ -10,21 +10,23 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <pthread.h>
+#include <unistd.h>
+#include <libft.h>
void
- *ft_music_thread(void *vargp)
+ ft_music_fork(char **mcmd_words, char *const envp[])
{
- t_cub *cl;
+ execve(*(mcmd_words + 0), mcmd_words, envp);
+}
- cl = (t_cub *)vargp;
+void
+ ft_enable_music(t_cub *cl)
+{
cl->isoldmus = 1;
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
- while (1)
- system(cl->mlist.music_cmd);
- return (NULL);
+ cl->mpid = fork();
+ if (cl->mpid == 0)
+ {
+ ft_music_fork(cl->mlist.mcmd_words, cl->envp);
+ }
}