Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

Commit

Permalink
Added window destroy on error when a thread can't be created
Browse files Browse the repository at this point in the history
  • Loading branch information
Kilian BOTREL committed Apr 1, 2019
1 parent a110818 commit 4cea23e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion srcs/core/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: kibotrel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/28 01:06:30 by kibotrel #+# #+# */
/* Updated: 2019/04/01 17:09:58 by kibotrel ### ########.fr */
/* Updated: 2019/04/01 17:41:10 by kibotrel ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -47,7 +47,10 @@ void threads(t_env *env, void *id, void *win, void *img)
{
while (++i < THREADS)
if (pthread_create(&env->threads[i], NULL, (void*)selector, env))
{
mlx_destroy_window(env->mlx->id, env->mlx->win);
ft_print_error(ERR_THREAD_CREATE, 4);
}
i = -1;
while (++i < THREADS)
pthread_join(env->threads[i], NULL);
Expand Down

0 comments on commit 4cea23e

Please sign in to comment.