New test file (forgotten from checkin last week).
This commit is contained in:
parent
3ac8359afd
commit
01be513ed1
1 changed files with 52 additions and 0 deletions
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