-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 30 October 2003 01:37, Ola Leifler wrote:
[snip]
haven't found any useful informaton on it, at least not if you're using
SWIG. First, I tried to start Guile from a C-program in one C-thread
while the other C-thread printed some data repeatedly that came from
this global variable. Guile could not successfully change this parameter
so that the C-thread saw the change. See code snippet below. I thought
this was because Guile loaded a shared library in order to get access to
the C interface and thus loaded a *copy* of all the functions/variables
that were already accessible to the C program.
extern tortoise *t;
void inner_main(int argc, char *argv[]){
pid_t pid;
int exit_val;
t = make_tortoise();
switch(pid = fork()) {
When you fork a program, a copy of the address space is made so now the child
has copies of all the variables in the main program. You need to use threads
to do what you want to do. Pthreads should work with both Guile 1.6 and 1.7,
but you must be careful only to access Guile from one thread at a time with
1.6 (with 1.7 it shouldn't matter as long as Guile is using the pthreads
backend).