1
/* Copyright (C) 2008 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
5
* License as published by the Free Software Foundation; either
6
* version 2.1 of the License, or (at your option) any later version.
8
* This library is distributed in the hope that it will be useful,
9
* but 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 02110-1301 USA
1
18
#include <pthread.h>
2
19
#include <libguile.h>
4
void * thread_inner_main (void * unused);
5
void * thread_main (void * unused);
6
void * do_join (void * data);
7
void * inner_main (void * unused);
21
void *thread_inner_main (void *unused);
22
void *thread_main (void *unused);
23
void *do_join (void *data);
24
void *inner_main (void *unused);
9
void * thread_inner_main (void * unused)
27
thread_inner_main (void *unused)
12
char* argv[] = { "guile",
14
"(or (current-module) (exit -1))",
33
"(or (current-module) (exit -1))",
16
37
scm_shell (argc, argv);
18
return NULL; /* dummy */
39
return NULL; /* dummy */
21
void * thread_main (void * unused)
43
thread_main (void *unused)
23
45
scm_with_guile (&thread_inner_main, NULL);
25
return NULL; /* dummy */
47
return NULL; /* dummy */
28
void * do_join (void * data)
30
pthread_t *thread = (pthread_t *)data;
53
pthread_t *thread = (pthread_t *) data;
32
55
pthread_join (*thread, NULL);
34
return NULL; /* dummy */
57
return NULL; /* dummy */
37
void * inner_main (void * unused)
61
inner_main (void *unused)
41
65
pthread_create (&thread, NULL, &thread_main, NULL);
42
66
scm_without_guile (do_join, &thread);
44
return NULL; /* dummy */
68
return NULL; /* dummy */
47
int main (int argc, char **argv)
72
main (int argc, char **argv)
49
74
scm_with_guile (&inner_main, NULL);