diff options
Diffstat (limited to 'src/ft_music.c')
-rw-r--r-- | src/ft_music.c | 24 |
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); + } } |