由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - C++ new/delete not thread safe?
相关主题
Does Linux support thread?multithread question
unix network programming (Stevens) book V1 (2ed, 3ed) code cannot run on Linuxwho can tell me how many threads solaris server s
Help needed, about pthread...Re: [转载] 什么是LWP呢?Re: 如何在Linux/Unix下获取微秒级的进程时间?
where is gcc?[转载] how to debug multi-threaded program?
A question about thread of unixHave anyone installed FreeBSD on your PC
[转载] shared library一问再介绍一篇文章 (转载)
[转载] ALERM CLOCKRe: Find files and delete
[转载] Questions about thread.If I delete a file, how to restore.
相关话题的讨论汇总
话题: thread话题: delete话题: c++话题: new话题: safe
进入Unix版参与讨论
1 (共1页)
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

1 (共1页)
进入Unix版参与讨论
相关主题
If I delete a file, how to restore.A question about thread of unix
IMAP4 server[转载] shared library一问
how to stop "at"[转载] ALERM CLOCK
link 一问[转载] Questions about thread.
Does Linux support thread?multithread question
unix network programming (Stevens) book V1 (2ed, 3ed) code cannot run on Linuxwho can tell me how many threads solaris server s
Help needed, about pthread...Re: [转载] 什么是LWP呢?Re: 如何在Linux/Unix下获取微秒级的进程时间?
where is gcc?[转载] how to debug multi-threaded program?
相关话题的讨论汇总
话题: thread话题: delete话题: c++话题: new话题: safe