1 /* babl - dynamically extendable universal pixel conversion library.
2 * Copyright (C) 2009 Martin Nordholts
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, see
16 * <https://www.gnu.org/licenses/>.
29 #define N_ITERATIONS_PER_THREAD 100
33 babl_fish_path_stress_test_thread_func (void *not_used
)
37 for (i
= 0; i
< N_ITERATIONS_PER_THREAD
; i
++)
39 /* Try to get a fish with an as complex conversion path as
42 const Babl
*fish
= babl_fish ("R'G'B'A u16", "YA double");
44 /* Just do something random with the fish */
54 pthread_t threads
[N_THREADS
];
59 /* Run a few threads at the same time */
60 for (i
= 0; i
< N_THREADS
; i
++)
62 pthread_create (&threads
[i
],
64 babl_fish_path_stress_test_thread_func
,
68 /* Wait for them all to finish */
69 for (i
= 0; i
< N_THREADS
; i
++)
71 pthread_join (threads
[i
],
72 NULL
/* thread_return */);
77 /* If we didn't crash we assume we're OK. We might want to add more
78 * asserts in the test later