[R] C++ streams in shared library in cause R to hang? (linux)

flyfish72@fastmail.fm flyfish72 at fastmail.fm
Sat Nov 22 00:41:34 CET 2003


I'm using dyn.load() to load in a shared library compiled for R on linux.
 The code does quite a bit (DB accesses, C-style file reads/writes) with
no trouble, but hangs when it reaches code that uses C++ streams,
specifically operator>>() and operator<<().  From the debugger output
(below) it seems like it could be __flockfile() related (maybe a deadlock
of some sort?).

Has anyone encountered anything like this before?  Or anything obvious
jump to mind for anyone?

Thank you!
Annie Bibble

Debugger output:
#0  0x40112aa5 in __sigsuspend (set=0xbfffec10)
    at ../sysdeps/unix/sysv/linux/sigsuspend.c:45
#1  0x40f63079 in __pthread_wait_for_restart_signal (self=0x40f6bd60)
    at pthread.c:967
#2  0x40f64d39 in __pthread_alt_lock (lock=0x9203448, self=0x0) at
#3  0x40f61c16 in __pthread_mutex_lock (mutex=0x9203438) at mutex.c:120
#4  0x40f63e12 in __flockfile (stream=0xbfffefa4) at lockfile.c:39
#5  0x40e35ba8 in read_int () from /usr/lib/libstdc++-libc6.2-2.so.3
#6  0x40e35f58 in istream::operator>> () from
#7  0x4093f2e2 in myFunc () at myfunc.cc:347

More information about the R-help mailing list