bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #20814] Issues with multithreading (using pthread, libguile 1.8.2)


From: anonymous
Subject: [bug #20814] Issues with multithreading (using pthread, libguile 1.8.2)
Date: Mon, 20 Aug 2007 08:48:11 +0000
User-agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.6 (like Gecko) (Kubuntu)

Follow-up Comment #3, bug #20814 (project guile):

Hi

Of course, the simplest sample code that refuses to run is the following:
#include <libguile.h>
void* scm_test (void* l){
  SCM_TICK;
  scm_c_eval_string("(write (+ 6 5)) (newline)");
}

int main(int argc, char** argv){
  pthread_t blah;
  scm_init_guile();
  pthread_create(&blah, 0,scm_test,0);
  while(1)
    {
      SCM_TICK;
      scm_c_primitive_load("test.scm");
    }
}
This is running on Kubuntu GNU/Linux, here's the output of uname -a:
Linux zero-desktop 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686
GNU/Linux
Interestingly, the above sample code has a different problem, namely:
./a.out: 
Symbol `scm_i_thread_key' has different size in shared object, consider
re-linking
Segmentatiefout (core dumped)

The above might be a specific problem with my guile installation.

The other code with its amount of thread-safety issues (i.e. my original
program with some guile additions), has a rather large amount of non-guile
related code in it, so I'll omit that in the sample code for now, but,
condensed, it'd come down to roughly:


void* guile_main(void* arglet){
  scm_shell(0,0);
}

void* run_guile(void* func){
  scm_with_guile(func,0);
}

pthread_t guile_exec_thread(void* func){
  pthread_t thread;
  pthread_create(&thread,NULL,run_guile,func);
}


int
main (int argc, char **argv)
{
  //misc initialization
  guile_exec_thread(guile_main);
  scm_init_guile();
  while (1)
    {
      SCM_TICK;
      //the body of a game's drawing loop (uses loads of OpenGL and other
non-guile calls)
      scm_c_primitive_load("test.scm");
      //sleep until the next frame
    }
  return 0;
}

I'll provide more information if necessary and for now, I'll recompile guile
to see if that would fix my first problem.

Thanks for taking the time to discuss this.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?20814>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]