This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Iostream deadlock...
Hi Martin,
here a quite small demonstration program showing the deadlock.
I hope you now will do something with the problem.
Another observation, if you remove the RTLD_GLOBAL flags it always works
so the problem must be related to some symbol exported by the pthreads lib.
Cheers, Fons.
//------------- tb.cxx ----------------
// On linux compile with: g++ -o tb tb.cxx -ldl
#include <iostream.h>
#include <fstream.h>
#include <dlfcn.h>
int main()
{
const char *fname = "tb.cxx";
int c;
ifstream file0(fname);
//c = file0.get(); // call get() before loading pthread
// and the problem disappears
// load libpthread.so
void *handle = dlopen("/usr/lib/libpthread.so", RTLD_GLOBAL | RTLD_LAZY);
if (!handle) {
cerr << "dlopen error" << endl;
return 1;
}
ifstream file1(fname);
if (!file1) {
cerr << "Cannot open file " << fname << endl;
return 1;
}
c = file1.get(); // remove first character <-- deadlock here
char line[256];
file1 >> ws; // eat whitespace
file1 >> line;
cout << "First token is: " << line << endl;
return 0;
}
"Martin v. Loewis" wrote:
>
> > could somebody tell me the status of the dealock problem in iostreams?
>
> It is the first time I heard about the problem.
>
> > Any change this will be fixed soon?
>
> That's unlikely. Without seeing the source, I'd assume that it is a
> bug in the application, or a problem where the application relies on
> things that are not guaranteed by the implementation. It is not even
> clear to me whether your problem is the same one as Bob Glickstein's:
> even though the symptoms are similar, the causes could be different.
>
> IOW, nobody will do anything with that problem unless there is an
> example demonstrating it.
>
> Regards,
> Martin
--
Org: CERN, European Laboratory for Particle Physics.
Mail: 1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248
WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910