From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA23510; Fri, 11 Jul 2003 17:07:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA25861 for ; Fri, 11 Jul 2003 17:07:56 +0200 (MET DST) Received: from smtp3.hushmail.com (smtp3.hushmail.com [65.39.178.33]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h6BF7sT10147 for ; Fri, 11 Jul 2003 17:07:55 +0200 (MET DST) Received: from mailserver1.hushmail.com (mailserver1.hushmail.com [65.39.178.20]) by smtp3.hushmail.com (Postfix) with ESMTP id C4EA42CEB1 for ; Fri, 11 Jul 2003 08:06:48 -0700 (PDT) Received: from mailserver1.hushmail.com (localhost.hushmail.com [127.0.0.1]) by mailserver1.hushmail.com (8.12.6/8.12.3) with ESMTP id h6BF6mC4095182 for ; Fri, 11 Jul 2003 08:06:48 -0700 (PDT) (envelope-from annan@hushmail.com) Received: (from nobody@localhost) by mailserver1.hushmail.com (8.12.6/8.12.3/Submit) id h6BF6lJB095180 for caml-list@inria.fr; Fri, 11 Jul 2003 08:06:47 -0700 (PDT) Message-Id: <200307111506.h6BF6lJB095180@mailserver1.hushmail.com> Date: Fri, 11 Jul 2003 08:06:47 -0700 To: caml-list@inria.fr Subject: [Caml-list] Question re: otherlibs/systhread/posix.c From: X-Loop: caml-list@inria.fr X-Spam: no; 0.00; otherlibs:01 systhread:01 posix:01 hash:01 callbacks:01 callback:01 segfaults:01 systhreads:01 gdb:01 lwp:01 cvsweb:01 cvsroot:01 criticism:01 gpl:01 segfault:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Please excuse me if this is a newbie-ish question, I haven't been using OCaml that long. (But am enjoying it very much!) I'm working on a Jack (jackit.sf.net) binding for Ocaml, and things are progressing well. However, I'm running into a problem currently; the design of Jack uses lots of out-of-process callbacks to communicate between the daemon and client connections. I have a callback interface where an Ocaml client registers callbacks locally using Callback.register, then registers them in the C code with the jack daemon. However, I'm getting segfaults in caml_thread_leave_blocking_section (), in otherlibs/systhreads/posix.c, when dereferencing curr_thread. I'm guessing that this is due to there not being a pthread_key_t valid for the daemon process within the Ocaml context. Can someone suggest a workaround for this? If gdb is accurate, the jackd callback-handler thread appears in the client process as a new LWP, can I use pthread_key_create somehow within the callback code itself, and register it for use within Ocaml? Thanks in advance for any help, Annan Harley PS: Is there a fast way to get all of the C code in the libraries built with "-g"? I haven't seen it in the Makefiles, but I miss these things pretty regularly. PPS: I have the code itself in browseable CVS at http://diverspaces.dyndns.org/cvsweb.cgi/jahcaml ($CVSROOT) and as a tarball at http://diverspaces.dyndns.org/jahcaml_0_0_1.tar.gz Any comments or constructive criticism on the code itself are very welcome. It will be released under GPL when it seems to be generally usable, and I've done all of the requisite documentation. Thanks! client code causing segfault $CVSROOT/example_clients/port_connector.ml ocaml callback setup code $CVSROOT/jahcaml/jc_client.ml ocaml extern declarations $CVSROOT/jahcaml/jc_pervasive.ml C extern functions $CVSROOT/jahcaml/jc_pervasive.c C native functions executed by jackd $CVSROOT/jahcaml/jc_ntv.c The segfault occurs when the xrun_handler runs, usually during initialization in the following run, LWP 18692 is the jackd handler appearing in this process bash-2.05b$ gdb port_connector GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-slackware-linux"... (gdb) run Starting program: /home/annan/proj/jahcaml/jahcaml/port_connector [New Thread 16384 (LWP 18689)] [New Thread 32769 (LWP 18690)] [New Thread 16386 (LWP 18691)] start_package activated [New Thread 32771 (LWP 18692)] writing req... fd:8 sizeof(*req):92 reading response... fd:8 sizeof(*req):92 returning Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 32771 (LWP 18692)] caml_thread_leave_blocking_section () at posix.c:191 191 caml_bottom_of_stack= curr_thread->bottom_of_stack; (gdb) info threads * 4 Thread 32771 (LWP 18692) caml_thread_leave_blocking_section () at posix.c:191 3 Thread 16386 (LWP 18691) 0x403b87be in select () from /lib/libc.so.6 2 Thread 32769 (LWP 18690) 0x403b631c in poll () from /lib/libc.so.6 1 Thread 16384 (LWP 18689) 0x4030acd1 in sigsuspend () from /lib/libc.so.6 (gdb) where #0 caml_thread_leave_blocking_section () at posix.c:191 #1 0x080ad0f9 in leave_blocking_section () #2 0x08099291 in caml_io_mutex_lock (chan=0x8101340) at posix.c:239 #3 0x080b1cd1 in caml_output () #4 0x0808a119 in Pervasives__output_string_212 () #5 0x080a0021 in xrun (param=0x1) at jc_ntv.c:156 #6 0x4007943e in jack_client_thread () from /usr/local/lib/libjack.so.0 -----BEGIN PGP SIGNATURE----- Note: This signature can be verified at https://www.hushtools.com/verify Version: Hush 2.3 wkYEARECAAYFAj8Pe9cACgkQ/Bi5NW/hmNuOCwCfTil3kMWzRpiAtjrHzRuwzCFau4QA oKC7p5c5kbiiR90rl1058TnHLIIq =CVDs -----END PGP SIGNATURE----- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners