Click here to Skip to main content
15,900,511 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to display contents of a text file in EditBox?? Pin
Cool_Dev14-Nov-10 21:42
Cool_Dev14-Nov-10 21:42 
QuestionReadDirectoryChangesW failing Pin
Subrat Patnaik14-Nov-10 19:25
Subrat Patnaik14-Nov-10 19:25 
AnswerRe: ReadDirectoryChangesW failing Pin
Richard MacCutchan14-Nov-10 23:05
mveRichard MacCutchan14-Nov-10 23:05 
QuestionOpengl Multithreading (wglMakeCurrent() & wglShareLists() ) issue Pin
James_72214-Nov-10 18:32
James_72214-Nov-10 18:32 
QuestionHow to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 17:34
wangningyu14-Nov-10 17:34 
AnswerRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
Dr.Walt Fair, PE14-Nov-10 18:16
professionalDr.Walt Fair, PE14-Nov-10 18:16 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 18:49
wangningyu14-Nov-10 18:49 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
Dr.Walt Fair, PE14-Nov-10 19:02
professionalDr.Walt Fair, PE14-Nov-10 19:02 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 19:06
wangningyu14-Nov-10 19:06 
AnswerRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
Randor 14-Nov-10 19:25
professional Randor 14-Nov-10 19:25 
GeneralRe: How to get the whole view's screen shot when the view has scroll bar ? Pin
wangningyu14-Nov-10 19:27
wangningyu14-Nov-10 19:27 
QuestionHow can find List item click or checkbox click? Pin
Le@rner12-Nov-10 22:22
Le@rner12-Nov-10 22:22 
AnswerRe: How can find List item click or checkbox click? Pin
Richard MacCutchan12-Nov-10 23:36
mveRichard MacCutchan12-Nov-10 23:36 
GeneralRe: How can find List item click or checkbox click? Pin
Le@rner12-Nov-10 23:48
Le@rner12-Nov-10 23:48 
GeneralRe: How can find List item click or checkbox click? Pin
Richard MacCutchan13-Nov-10 0:18
mveRichard MacCutchan13-Nov-10 0:18 
AnswerRe: How can find List item click or checkbox click? Pin
Code-o-mat13-Nov-10 0:47
Code-o-mat13-Nov-10 0:47 
AnswerRe: How can find List item click or checkbox click? Pin
David Crow13-Nov-10 15:41
David Crow13-Nov-10 15:41 
GeneralRe: How can find List item click or checkbox click? Pin
«_Superman_»14-Nov-10 4:01
professional«_Superman_»14-Nov-10 4:01 
QuestionFault Address error Pin
MKC00212-Nov-10 21:24
MKC00212-Nov-10 21:24 
AnswerRe: Fault Address error Pin
Stephen Hewitt13-Nov-10 2:27
Stephen Hewitt13-Nov-10 2:27 
AnswerRe: Fault Address error Pin
Code-o-mat13-Nov-10 8:48
Code-o-mat13-Nov-10 8:48 
QuestionCString to double [modified] Pin
john563212-Nov-10 21:10
john563212-Nov-10 21:10 
AnswerRe: CString to double Pin
Stephen Hewitt13-Nov-10 2:30
Stephen Hewitt13-Nov-10 2:30 
QuestionTerminating OpenMP loop early Pin
Damir Valiulin12-Nov-10 12:51
Damir Valiulin12-Nov-10 12:51 
Another poster already asked similar question already (http://www.codeproject.com/Messages/3644795/What-is-the-best-way-to-break-return-from-OpenMP-l.aspx[^]), but I'll ask anyway.

I have a function that checks if a point belongs to an object in array. The loop looks like this:

for (int i=0; i<N; i++)
{
  if (point_is_in_object(obj[i], pt){
    return true;
  }
}
return false;


I parallelized it with OpenMP by adding shared boolean flag found.

bool found = false;
#pragma omp parallel for
for (int i=0; i<N; i++)
{
  if (!found)
  {
    if (point_is_in_object(obj[i], pt){
      found = true;
      #pragma omp flush (found)
    }
  }
}

return found;


Is this a good way to do this? Could this cause access violation when one thread is writing and the other thread is reading memory contents of found flag?

I'm new to OpenMP and don't know much how it operates under the hood. With standard Win32 I would isolate access to found with critical section. Should I do the same here as well and add critical clause?

Thanks
AnswerRe: Terminating OpenMP loop early Pin
Randor 13-Nov-10 1:11
professional Randor 13-Nov-10 1:11 

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.