Click here to Skip to main content
15,886,740 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to use an event object for synchronization.? Pin
pasztorpisti12-Aug-13 5:42
pasztorpisti12-Aug-13 5:42 
GeneralRe: How to use an event object for synchronization.? Pin
Erudite_Eric16-Aug-13 1:30
Erudite_Eric16-Aug-13 1:30 
GeneralRe: How to use an event object for synchronization.? Pin
pasztorpisti16-Aug-13 1:53
pasztorpisti16-Aug-13 1:53 
AnswerRe: How to use an event object for synchronization.? Pin
Krishnakumartg12-Aug-13 6:15
Krishnakumartg12-Aug-13 6:15 
AnswerRe: How to use an event object for synchronization.? Pin
Erudite_Eric16-Aug-13 1:32
Erudite_Eric16-Aug-13 1:32 
GeneralRe: How to use an event object for synchronization.? Pin
pasztorpisti16-Aug-13 1:52
pasztorpisti16-Aug-13 1:52 
GeneralRe: How to use an event object for synchronization.? Pin
Erudite_Eric16-Aug-13 23:02
Erudite_Eric16-Aug-13 23:02 
GeneralRe: How to use an event object for synchronization.? Pin
pasztorpisti17-Aug-13 1:31
pasztorpisti17-Aug-13 1:31 
I assume a child process because he has written about it in the body of the messasge: "running a commandline operation". What is this if not a child process or in some extreme circumstances a process launched somewhere else? But you know what, let OP to decide that: he never told that it isn't a child process.

What happens if you timeout the event? You start waiting for it again? Or you assume that the process has terminated when it is still running? And how do you signal to the gui thread when the event becomes signaled without bleating on SendMessage/PostMessage/PostThreadMessage? I think we can safely ignore "bleating on" this because OP probably knows this all...

OP tries to solve a problem and he isn't using the right tools, that's it. Maybe the title of the question was only about events but have you read the body of the message? I provided some alternative solutions because as many other problems this one can also be solved in many ways - all of them having its pros/cons. The solution involves waiting/polling the process handle either from a thread or from a periodic event from 1 thread.

My advice to OP was using the poll solution because beginner's multithreading solutions are buggy in 99% of the cases and polling is a perfect alternative in this case, wait cancellation is also easier to implement with polling.

My advice to you: Learn how to respect people and how to talk to them accordingly. Giving wrong answers and making mistakes is okay, submitting positive criticism is OK, submitting destructive criticism and destroying morale on the forums is not okay, treating yourself and your solutions perfect in contrast to others and others' solution is not okay. As I previously mentioned respect is mutual or nonexistent. The fact that my post is "too" long according to you is unimportant. Whether my solution is good or not? Let OP and others decide...

And you know what? Why don't you submit your solutions if you think you are that smart?
GeneralRe: How to use an event object for synchronization.? Pin
mbatra3126-Dec-13 19:35
mbatra3126-Dec-13 19:35 
GeneralRe: How to use an event object for synchronization.? Pin
mbatra3126-Dec-13 19:34
mbatra3126-Dec-13 19:34 
QuestionCButton and CListCtrl two controls how self drawing Pin
ztwisdom9-Aug-13 16:17
ztwisdom9-Aug-13 16:17 
SuggestionRe: CButton and CListCtrl two controls how self drawing Pin
Richard MacCutchan9-Aug-13 23:28
mveRichard MacCutchan9-Aug-13 23:28 
AnswerRe: CButton and CListCtrl two controls how self drawing Pin
Krishnakumartg12-Aug-13 6:17
Krishnakumartg12-Aug-13 6:17 
QuestionChanging Treeview control apperance Pin
Member 78617636-Aug-13 22:58
Member 78617636-Aug-13 22:58 
AnswerRe: Changing Treeview control apperance Pin
_AnsHUMAN_ 7-Aug-13 2:10
_AnsHUMAN_ 7-Aug-13 2:10 
GeneralRe: Changing Treeview control apperance Pin
Member 78617637-Aug-13 3:38
Member 78617637-Aug-13 3:38 
GeneralRe: Changing Treeview control apperance Pin
Richard MacCutchan7-Aug-13 7:18
mveRichard MacCutchan7-Aug-13 7:18 
Questionregarding edit box Pin
Member 101853676-Aug-13 21:59
Member 101853676-Aug-13 21:59 
SuggestionRe: regarding edit box Pin
Richard MacCutchan6-Aug-13 22:18
mveRichard MacCutchan6-Aug-13 22:18 
AnswerRe: regarding edit box Pin
David Crow7-Aug-13 3:36
David Crow7-Aug-13 3:36 
AnswerRe: regarding edit box Pin
Erudite_Eric8-Aug-13 1:26
Erudite_Eric8-Aug-13 1:26 
Questionhow to check file name is valid or not Pin
Le@rner5-Aug-13 21:34
Le@rner5-Aug-13 21:34 
AnswerRe: how to check file name is valid or not Pin
«_Superman_»5-Aug-13 22:09
professional«_Superman_»5-Aug-13 22:09 
AnswerRe: how to check file name is valid or not Pin
pasztorpisti5-Aug-13 22:27
pasztorpisti5-Aug-13 22:27 
AnswerRe: how to check file name is valid or not Pin
Joe Woodbury9-Aug-13 10:59
professionalJoe Woodbury9-Aug-13 10:59 

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.