1 /* Copyright (C) 2011, 2012 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 a thread created with `scm_spawn_thread' can be joined.
20 See <http://thread.gmane.org/gmane.lisp.guile.devel/11804> for the
33 thread_main (void *data
)
39 thread_handler (void *data
, SCM key
, SCM args
)
45 inner_main (void *data
)
49 thread
= scm_spawn_thread (thread_main
, 0, thread_handler
, 0);
50 timeout
= scm_from_unsigned_integer (time (NULL
) + 10);
51 return SCM2PTR (scm_join_thread_timed (thread
, timeout
, SCM_BOOL_F
));
56 main (int argc
, char **argv
)
60 result
= PTR2SCM (scm_with_guile (inner_main
, 0));
61 return scm_is_true (result
) ? EXIT_SUCCESS
: EXIT_FAILURE
;