Click here to Skip to main content
15,881,380 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionThreads and Pointers Pin
BobInNJ19-Mar-09 7:36
BobInNJ19-Mar-09 7:36 
AnswerRe: Threads and Pointers Pin
led mike19-Mar-09 7:41
led mike19-Mar-09 7:41 
AnswerRe: Threads and Pointers Pin
Eytukan19-Mar-09 7:41
Eytukan19-Mar-09 7:41 
GeneralRe: Threads and Pointers Pin
led mike19-Mar-09 7:58
led mike19-Mar-09 7:58 
GeneralRe: Threads and Pointers Pin
Eytukan19-Mar-09 8:12
Eytukan19-Mar-09 8:12 
AnswerRe: Threads and Pointers Pin
CPallini19-Mar-09 7:46
mveCPallini19-Mar-09 7:46 
GeneralRe: Threads and Pointers Pin
led mike19-Mar-09 9:42
led mike19-Mar-09 9:42 
AnswerRe: Threads and Pointers Pin
cmk19-Mar-09 13:17
cmk19-Mar-09 13:17 
new will call malloc, which (eventually) calls HeapAlloc on the module CRT heap.

If you look at the Heap* API function docs you will see that they are thread safe by default (though this feature can be disabled) ... actually, to be precise, malloc will use a CRT lock (critical section) to lock the heap, but the effect is the same.

So yes, new and delete are thread safe.

As to your example; as led mike pointed out, it depends on what you are doing in 'Do some work, details not shown'.

...cmk

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack

QuestionEdit control disappears from dialog [modified] Pin
rp_suman19-Mar-09 7:07
rp_suman19-Mar-09 7:07 
AnswerRe: Edit control disappears from dialog Pin
Code-o-mat19-Mar-09 7:27
Code-o-mat19-Mar-09 7:27 
QuestionC4244 conversion from 'double' to 'float' warning Pin
penny black19-Mar-09 6:47
penny black19-Mar-09 6:47 
AnswerRe: C4244 conversion from 'double' to 'float' warning Pin
Eytukan19-Mar-09 6:56
Eytukan19-Mar-09 6:56 
QuestionRe: C4244 conversion from 'double' to 'float' warning Pin
penny black19-Mar-09 7:02
penny black19-Mar-09 7:02 
AnswerRe: C4244 conversion from 'double' to 'float' warning [fixed] Pin
CPallini19-Mar-09 7:21
mveCPallini19-Mar-09 7:21 
GeneralRe: C4244 conversion from 'double' to 'float' warning Pin
Eytukan19-Mar-09 7:29
Eytukan19-Mar-09 7:29 
GeneralRe: C4244 conversion from 'double' to 'float' warning Pin
CPallini19-Mar-09 7:38
mveCPallini19-Mar-09 7:38 
GeneralRe: C4244 conversion from 'double' to 'float' warning Pin
penny black19-Mar-09 7:36
penny black19-Mar-09 7:36 
QuestionRe: C4244 conversion from 'double' to 'float' warning Pin
CPallini19-Mar-09 7:41
mveCPallini19-Mar-09 7:41 
AnswerRe: C4244 conversion from 'double' to 'float' warning Pin
penny black19-Mar-09 7:47
penny black19-Mar-09 7:47 
GeneralRe: C4244 conversion from 'double' to 'float' warning Pin
Stuart Dootson19-Mar-09 8:13
professionalStuart Dootson19-Mar-09 8:13 
GeneralRe: C4244 conversion from 'double' to 'float' warning Pin
Eytukan19-Mar-09 8:15
Eytukan19-Mar-09 8:15 
AnswerRe: C4244 conversion from 'double' to 'float' warning Pin
Cedric Moonen19-Mar-09 8:32
Cedric Moonen19-Mar-09 8:32 
GeneralRe: C4244 conversion from 'double' to 'float' warning Pin
CPallini19-Mar-09 8:48
mveCPallini19-Mar-09 8:48 
GeneralRe: C4244 conversion from 'double' to 'float' warning Pin
CPallini19-Mar-09 8:49
mveCPallini19-Mar-09 8:49 
AnswerRe: C4244 conversion from 'double' to 'float' warning Pin
Eytukan19-Mar-09 7:28
Eytukan19-Mar-09 7:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.