I've encountered a strange problem with CommonC++ library.
Threads are not started and ended properly on my system:
When Start() is invoked Run() is not called.
This only happens on my RH 7.0 system. On RH 6.2 all work just fine.
I'm trying to find the valuable differences between dist but still not
succeeded.
Building:
$ g++ bug.cpp -lz -ldl -lpthread -lccxx -lccstd -lccio
When I run it I get this:
$ ./a.out
before start()...
exiting...
When I tries to debug th code I got:
(gdb) br ThreadTest::Run(void)
Breakpoint 1 at 0x8048e6e: file bug.cpp, line 10.
(gdb) r
Starting program: /usr/local/rpms/BUILD/CommonC++-1.2.5.1/demo/./a.out
[New Thread 1024 (LWP 1747)]
before start()...
[New Thread 2049 (LWP 1757)]
[New Thread 1026 (LWP 1758)]
[Switching to Thread 1026 (LWP 1758)]
Breakpoint 1, 0x8048e6e in ThreadTest::Run (this=0x804a488) at bug.cpp:10
10 void Run() { cout << "Run()..." << endl;};
(gdb) n
0exiting...
ptrace: No such process.
0x40111d85 in __sigsuspend (set=0xbf7ff8ec)
at ../sysdeps/unix/sysv/linux/sigsuspend.c:45
45 ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Greetings there.
I've encountered a strange problem with CommonC++ library.
Threads are not started and ended properly on my system:
When Start() is invoked Run() is not called.
This only happens on my RH 7.0 system. On RH 6.2 all work just fine.
I'm trying to find the valuable differences between dist but still not
succeeded.
Can you tell me, what 's wrong?
I am using following tools:
gcc-c++-2.96-54
glibc-2.1.94-3
glibc-devel-2.1.92-14
make-3.79.1-5
CommonC++-1.2.5-1
As example I use bug1.cpp in demo directory from CommonC++ dist.
$ cat bug.cpp
#include <cc++/config.h>
#include <cc++/macros.h>
#include <cc++/thread.h>
#include <cc++/socket.h>
class ThreadTest : public Thread
{
private:
void Run() { cout << "Run()..." << endl;};
void Final() { cout << "Final()..." << endl; delete this;};
};
int main()
{
ThreadTest *thread = new ThreadTest;
cout << "before start()..." << endl;
thread->Start();
cout << "exiting..." << endl;
}
Building:
$ g++ bug.cpp -lz -ldl -lpthread -lccxx -lccstd -lccio
When I run it I get this:
$ ./a.out
before start()...
exiting...
When I tries to debug th code I got:
(gdb) br ThreadTest::Run(void)
Breakpoint 1 at 0x8048e6e: file bug.cpp, line 10.
(gdb) r
Starting program: /usr/local/rpms/BUILD/CommonC++-1.2.5.1/demo/./a.out
[New Thread 1024 (LWP 1747)]
before start()...
[New Thread 2049 (LWP 1757)]
[New Thread 1026 (LWP 1758)]
[Switching to Thread 1026 (LWP 1758)]
Breakpoint 1, 0x8048e6e in ThreadTest::Run (this=0x804a488) at bug.cpp:10
10 void Run() { cout << "Run()..." << endl;};
(gdb) n
0exiting...
ptrace: No such process.
0x40111d85 in __sigsuspend (set=0xbf7ff8ec)
at ../sysdeps/unix/sysv/linux/sigsuspend.c:45
45 ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.
gcc-2.96 is buggy. Look at http://gcc.gnu.org
May be some packeges was complied by gcc-2.96 in RH 7.0
You can try downgrade gcc to gcc-2.95.2 (latest stable version).