z*******w 发帖数: 79 | 1 I have a program with 2 threads running on Solaris using g++.
I noticed that I got core-dumped at one thread's:
new char[2];
gdb trace tell me it's inside malloc.
And I checked my program, it happend when one thread 1 send data
to another thread 2. In thread 1 it will delete some data, thread 2
will use new to create an instance.
After I comment the delete of thread 1, I got no core-dump at all.
So, I am very suspicious of g++'s new/delete is not thread safe.
Can somebody verify this? Th | m*****e 发帖数: 4193 | 2 Haven't you just verified it?
I don't think any basic C++ operations are thread safe. It's your
business, not compiler's.
【在 z*******w 的大作中提到】 : I have a program with 2 threads running on Solaris using g++. : I noticed that I got core-dumped at one thread's: : new char[2]; : gdb trace tell me it's inside malloc. : And I checked my program, it happend when one thread 1 send data : to another thread 2. In thread 1 it will delete some data, thread 2 : will use new to create an instance. : After I comment the delete of thread 1, I got no core-dump at all. : So, I am very suspicious of g++'s new/delete is not thread safe. : Can somebody verify this? Th
| l******n 发帖数: 3 | 3 Not Java, no monitor, implement lock, cv by u self
【在 m*****e 的大作中提到】 : Haven't you just verified it? : I don't think any basic C++ operations are thread safe. It's your : business, not compiler's.
| n********g 发帖数: 10 | 4 try add -D _REENTRANT whlie compiling.
【在 z*******w 的大作中提到】 : I have a program with 2 threads running on Solaris using g++. : I noticed that I got core-dumped at one thread's: : new char[2]; : gdb trace tell me it's inside malloc. : And I checked my program, it happend when one thread 1 send data : to another thread 2. In thread 1 it will delete some data, thread 2 : will use new to create an instance. : After I comment the delete of thread 1, I got no core-dump at all. : So, I am very suspicious of g++'s new/delete is not thread safe. : Can somebody verify this? Th
|
|