接手了一个c++的程序,以前的程序员不愿意指导,自己也比较愚钝。请大侠们指点
不明白为什么usleep(1000)发生overflow?是因为其他线程有overflow的情况吗?如何
查看其他线程里面的变量值呢?
Program terminated with signal 6, Aborted.
#0 0x0000003cfd89a1e1 in nanosleep () from /lib64/libc.so.6
(gdb) bt
#0 0x0000003cfd89a1e1 in nanosleep () from /lib64/libc.so.6
#1 0x0000003cfd8ce8f4 in usleep () from /lib64/libc.so.6
#2 0x0000000000498e17 in MyClass::StartUp (this=0x2b4484725010, aName=
Traceback (most recent call last):
File "/usr/share/gdb/python/libstdcxx/v6/printers.py", line 469, in to_
string
return self.val['_M_dataplus']['_M_p'].string (encoding, length = len)
OverflowError: signed integer is greater than maximum
) at src/MyClass.cpp:153
#3 0x00000000004a8382 in main (argc=2, argv=0x7fffcc8cdb88) at src/classfile
.cpp:173
(gdb) frame 2
#2 0x0000000000498e17 in MyClass::StartUp (this=0x2b4484725010, aName=
Traceback (most recent call last):
File "/usr/share/gdb/python/libstdcxx/v6/printers.py", line 469, in to_
string
return self.val['_M_dataplus']['_M_p'].string (encoding, length = len)
OverflowError: signed integer is greater than maximum
) at src/MyClass.cpp:153
warning: Source file is more recent than executable.
153 usleep(1000);
(gdb) l
148
149 while ( GetThreadListSize() > 2 )
150 {
151 int oTry = 0;
152 while (oTry++ < 50)
153 usleep(1000);
154 }
155 m_Thread_List.RemoveAll();
156
157 return (0);
(gdb) print oTry
$1 = 44
(gdb)