caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Question re: otherlibs/systhread/posix.c
@ 2003-07-11 15:06 annan
  0 siblings, 0 replies; only message in thread
From: annan @ 2003-07-11 15:06 UTC (permalink / raw)
  To: caml-list


-----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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-11 15:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-11 15:06 [Caml-list] Question re: otherlibs/systhread/posix.c annan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).