From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Antoine Mathys Newsgroups: gmane.lisp.guile.user Subject: threading issue in 1.8.3 Date: Fri, 11 Jan 2008 15:11:09 +0100 (CET) Message-ID: <497155.28911.qm@web27613.mail.ukl.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1979637617-1200060669=:28911" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1200060718 22600 80.91.229.12 (11 Jan 2008 14:11:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2008 14:11:58 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jan 11 15:12:18 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JDKcF-0006Pj-Sa for guile-user@m.gmane.org; Fri, 11 Jan 2008 15:12:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDKbs-0000pU-6t for guile-user@m.gmane.org; Fri, 11 Jan 2008 09:11:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JDKbJ-00009c-Lj for guile-user@gnu.org; Fri, 11 Jan 2008 09:11:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JDKbI-000079-4F for guile-user@gnu.org; Fri, 11 Jan 2008 09:11:12 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDKbH-00006N-JX for guile-user@gnu.org; Fri, 11 Jan 2008 09:11:11 -0500 Original-Received: from web27613.mail.ukl.yahoo.com ([217.146.177.232]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JDKbG-0001oE-Mi for guile-user@gnu.org; Fri, 11 Jan 2008 09:11:11 -0500 Original-Received: (qmail 29011 invoked by uid 60001); 11 Jan 2008 14:11:09 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=UxESdkIUANc+nVUB/EmlpYeVYPU5VlZcKLXbIPsfS6oxBZlByjhkzdg/y7ouGDkM3fWP+o3sEQmqCXGoKRQnwnoMX1DUyHjbvfKLjbmp+ist/XgsGtKD+OwKjYws1DdP1O+Tm52luUEA0V5XoJ16R+ervpQqWqoK7GuiKwABU9g=; X-YMail-OSG: MpemaRYVM1lEtcrZLynFUq53MGBRegh5f3pOnypLcAH76HBBM6oO.mEZf5mvwrOGjg-- Original-Received: from [83.173.207.28] by web27613.mail.ukl.yahoo.com via HTTP; Fri, 11 Jan 2008 15:11:09 CET X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6382 Archived-At: --0-1979637617-1200060669=:28911 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello, I am having a problem with threads in 1.8.3 . The offending program: ------------------ #include #include void * thread_inner_main (void * unused) { int argc = 0; char* argv[] = { 0 }; scm_shell (argc, argv); return NULL; /* dummy */ } void * thread_main (void * unused) { scm_with_guile (&thread_inner_main, NULL); return NULL; /* dummy */ } void * inner_main (void * unused) { pthread_t thread; pthread_create (&thread, NULL, &thread_main, NULL); pthread_join (thread, NULL); return NULL; /* dummy */ } int main (int argc, char **argv) { scm_with_guile (&inner_main, NULL); return 0; } ------------------ This produces the following output: ------------------ Backtrace: In unknown file: ?: 14* (if (or # #) (try-load-module name)) ?: 15 [try-load-module (ice-9 readline)] ?: 16 (or (begin (try-module-linked name)) (try-module-autoload name) ...) ?: 17* [try-module-autoload (ice-9 readline)] ?: 18 (let* (# # # #) (resolve-module dir-hint-module-name {#f}) (and # #)) ?: 19* [resolve-module (ice-9) {#f}] ?: 20 (let* ((full-name #)) (let* (#) (if already # #))) ... ?: 21 (cond ((module-ref module # {#f}) => (lambda # #)) (else (let* # # # ...))) ?: 22* [module-ref {#f} %app {#f}] ?: 23 (let* ((variable #)) (if (and variable #) (variable-ref variable) ...)) ?: 24* [module-variable {#f} %app] ?: 25 [module-search # {#f} %app] ... ?: 26 (or (fn m v) (loop (module-uses m))) ?: 27* [module-local-variable {#f} %app] ?: 28 (let* ((b #)) (or (and # b) (and # #))) ?: 29* [module-obarray-ref ... ?: 30* [module-obarray {#f}] ?: 31 (if (eq? # #) (struct-ref obj 0) (%record-type-error # obj)) ?: 32* [eq? ... ?: 33* [struct-vtable {#f}] : In procedure struct-vtable in expression (struct-vtable obj): : Wrong type argument in position 1 (expecting struct): #f ------------------ It seems that for some reason you cannot load modules from a different thread than the one which first initialized guile. Any idea how to get this to work ? Thanks in advance. P.S. I used 'pthread_create' instead of 'scm_spawn_thread' for simplification because for some reason 'join-thread' has no C equivalent. But maybe I am missing something here as well ? --------------------------------- Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail --0-1979637617-1200060669=:28911 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello,

I am having a problem with threads in 1.8.3 .

The offending program:

------------------
#include <pthread.h>
#include <libguile.h>

void * thread_inner_main (void * unused)
{
  int argc = 0;
  char* argv[] = { 0 };
  scm_shell (argc, argv);

  return NULL; /* dummy */
}

void * thread_main (void * unused)
{
  scm_with_guile (&thread_inner_main, NULL);

  return NULL; /* dummy */
}

void * inner_main (void * unused)
{
  pthread_t thread;

  pthread_create (&thread, NULL, &thread_main, NULL);
  pthread_join (thread, NULL);

  return NULL; /* dummy */
}

int main (int argc, char **argv)
{
  sc m_with_guile (&inner_main, NULL);

  return 0;
}
------------------

This produces the following output:

------------------
Backtrace:
In unknown file:
   ?: 14* (if (or # #) (try-load-module name))
   ?: 15  [try-load-module (ice-9 readline)]
   ?: 16  (or (begin (try-module-linked name)) (try-module-autoload
   name) ...)
   ?: 17* [try-module-autoload (ice-9 readline)]
   ?: 18  (let* (# # # #) (resolve-module dir-hint-module-name {#f})
   (and # #))
   ?: 19* [resolve-module (ice-9) {#f}]
   ?: 20  (let* ((full-name #)) (let* (#) (if already # #)))
    ...
   ?: 21  (cond ((module-ref module # {#f}) => (lambda # #)) (else
   (let* # # # ...)))
   ?: 22* [module-ref {#f} %app {#f}]
   ?: 23  (let* ((variable #)) (if (and variable #) (variable-ref
   variable) ...))
   ?: 24* [module-variable {#f} %app]
   ?: 25  [module-search #<procedure module-local-variable (m v)> {#f}
   %app]
    ...
   ?: 26  (or (fn m v) (loop (module-uses m)))
   ?: 27* [module-local-variable {#f} %app]
   ?: 28  (let* ((b #)) (or (and # b) (and # #)))
   ?: 29* [module-obarray-ref ...
   ?: 30*  [module-obarray {#f}]
   ?: 31   (if (eq? # #) (struct-ref obj 0) (%record-type-error #
   obj))
   ?: 32*  [eq? ...
   ?: 33*   [struct-vtable {#f}]

<unnamed port>: In procedure struct-vtable in expression
(struct-vtable obj):
<unnamed port>: Wrong type argument in position 1 (expecting struct):
#f
------------------

It seems that for some reason you cannot load modules from a different thread than the one which first initialized guile.

Any idea how to get this to work ?

Thanks in advance.


P.S.
I used 'pthread_create' instead of 'scm_spawn_thread' for
simplification because for some reason 'join-thread' has no C
equivalent. But maybe I am missing something here as well ?


Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail --0-1979637617-1200060669=:28911--