mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-13 17:20:21 +02:00
* modules.c (the_root_module): Moved before scm_current_module.
(scm_current_module): Return the root module if `the-module' fluid gives #f. * standalone/Makefile.am: Add stanza for test-with-guile-module. * standalone/test-with-guile-module.c: New test.
This commit is contained in:
parent
6ba395189f
commit
a06872c2bc
7 changed files with 86 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
|||
2008-02-01 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* standalone/Makefile.am: Add stanza for test-with-guile-module.
|
||||
|
||||
* standalone/test-with-guile-module.c: New test.
|
||||
|
||||
2008-01-22 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* COPYING: Removed.
|
||||
|
|
|
@ -11,3 +11,4 @@ test-num2integral
|
|||
test-round
|
||||
test-unwind
|
||||
test-list
|
||||
test-with-guile-module
|
||||
|
|
|
@ -110,6 +110,12 @@ TESTS += test-conversion
|
|||
check_SCRIPTS += test-use-srfi
|
||||
TESTS += test-use-srfi
|
||||
|
||||
# test-with-guile-module
|
||||
test_with_guile_module_CFLAGS = ${test_cflags}
|
||||
test_with_guile_module_LDADD = ${top_builddir}/libguile/libguile.la
|
||||
check_PROGRAMS += test-with-guile-module
|
||||
TESTS += test-with-guile-module
|
||||
|
||||
all-local:
|
||||
cd ${srcdir} && chmod u+x ${check_SCRIPTS}
|
||||
|
||||
|
|
52
test-suite/standalone/test-with-guile-module.c
Normal file
52
test-suite/standalone/test-with-guile-module.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
#include <pthread.h>
|
||||
#include <libguile.h>
|
||||
|
||||
void * thread_inner_main (void * unused);
|
||||
void * thread_main (void * unused);
|
||||
void * do_join (void * data);
|
||||
void * inner_main (void * unused);
|
||||
|
||||
void * thread_inner_main (void * unused)
|
||||
{
|
||||
int argc = 3;
|
||||
char* argv[] = { "guile",
|
||||
"-c",
|
||||
"(or (current-module) (exit -1))",
|
||||
0 };
|
||||
scm_shell (argc, argv);
|
||||
|
||||
return NULL; /* dummy */
|
||||
}
|
||||
|
||||
void * thread_main (void * unused)
|
||||
{
|
||||
scm_with_guile (&thread_inner_main, NULL);
|
||||
|
||||
return NULL; /* dummy */
|
||||
}
|
||||
|
||||
void * do_join (void * data)
|
||||
{
|
||||
pthread_t *thread = (pthread_t *)data;
|
||||
|
||||
pthread_join (*thread, NULL);
|
||||
|
||||
return NULL; /* dummy */
|
||||
}
|
||||
|
||||
void * inner_main (void * unused)
|
||||
{
|
||||
pthread_t thread;
|
||||
|
||||
pthread_create (&thread, NULL, &thread_main, NULL);
|
||||
scm_without_guile (do_join, &thread);
|
||||
|
||||
return NULL; /* dummy */
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
scm_with_guile (&inner_main, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue