aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_exit.c5
-rw-r--r--src/ft_music.c14
-rw-r--r--src/ft_treat_args.c4
-rw-r--r--src/ft_warp_level.c9
4 files changed, 11 insertions, 21 deletions
diff --git a/src/ft_exit.c b/src/ft_exit.c
index ca5201c..c7b2275 100644
--- a/src/ft_exit.c
+++ b/src/ft_exit.c
@@ -16,8 +16,6 @@
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
-#include <signal.h>
-#include <pthread.h>
static void
ft_free_lists(t_cub *clist)
@@ -67,8 +65,7 @@ int
}
if (clist->isoldmus && clist->wlist.inited)
{
- pthread_cancel(clist->tid);
- pthread_join(clist->tid, NULL);
+ /* kill fork() here */
}
ft_free_lists(clist);
ft_printf("Exiting program\n");
diff --git a/src/ft_music.c b/src/ft_music.c
index aec5e58..b9e9d89 100644
--- a/src/ft_music.c
+++ b/src/ft_music.c
@@ -14,17 +14,15 @@
#include <cub3d.h>
#include <stddef.h>
#include <stdlib.h>
-#include <pthread.h>
void
- *ft_music_thread(void *vargp)
+ ft_music_fork(t_cub *cl)
{
- t_cub *cl;
-
- cl = (t_cub *)vargp;
cl->isoldmus = 1;
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
while (1)
- system(cl->mlist.music_cmd);
- return (NULL);
+ {
+ ft_printf("qweqwe\n");
+ }
+ /* system(cl->mlist.music_cmd); */
+ /* execve here */
}
diff --git a/src/ft_treat_args.c b/src/ft_treat_args.c
index 2571709..b588b46 100644
--- a/src/ft_treat_args.c
+++ b/src/ft_treat_args.c
@@ -14,7 +14,6 @@
#include <cub3d.h>
#include <stddef.h>
#include <stdint.h>
-#include <pthread.h>
#include <unistd.h>
uint8_t
@@ -38,7 +37,8 @@ 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_music_fork(cl);
+ /* create music fork() here */
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 808b346..4d1ca12 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -16,8 +16,6 @@
#include <stddef.h>
#include <stdint.h>
#include <mlx.h>
-#include <signal.h>
-#include <pthread.h>
static void
ft_del_map(t_map *ml)
@@ -66,16 +64,13 @@ static void
{
if (isoldmus && !cl->mlist.ismusic)
{
- pthread_cancel(cl->tid);
- pthread_join(cl->tid, NULL);
+ /* stop fork() here */
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);
+ /* stop and recreate fork() here */
}
else if (isoldmus && cl->mlist.ismusic
&& !ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1))