1 /* Copyright (C) 2011 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public License
5 * as published by the Free Software Foundation; either version 3 of
6 * the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 /* Test whether threads created with `pthread_create' work, and whether
20 a secondary thread can call `scm_with_guile'. (bug #32436). */
33 /* Up to GC 7.2alpha5, calling `GC_INIT' from a secondary thread would
34 lead to a segfault. This was fixed in BDW-GC on 2011-04-16 by Ivan
35 Maidanski. See <http://thread.gmane.org/gmane.lisp.guile.bugs/5340>
38 #if (GC_VERSION_MAJOR > 7) \
39 || ((GC_VERSION_MAJOR == 7) && (GC_VERSION_MINOR > 2)) \
40 || ((GC_VERSION_MAJOR == 7) && (GC_VERSION_MINOR == 2) \
41 && (GC_ALPHA_VERSION > 5))
44 do_something (void *arg
)
46 scm_list_copy (scm_make_list (scm_from_int (1234), SCM_BOOL_T
));
54 scm_with_guile (do_something
, NULL
);
60 main (int argc
, char *argv
[])
64 for (i
= 0; i
< 77; i
++)
68 pthread_create (&thr
, NULL
, thread
, NULL
);
69 pthread_join (thr
, NULL
);
79 main (int argc
, char *argv
[])