1

Topic: Stop of two flows one

here since I use class CEvent from ATL.


In general all life  such construction, as:





CEvent m_evStop; 

//further in the designer 
m_evStop (FALSE/*init own*/, FALSE/*manual reset*/) 

//in two flows we wait this  
while (WAIT_OBJECT_0! =:: WaitForSingleObject (m_evStop, 10)) {/*delaem something extremely */} 



What my surprise was that  it appears is dropped by function WaitForSingleObject and I cut the second flow by means of TerminateThread, learned about it as added .


How one  to stop two flows?  ?

2

Re: Stop of two flows one

Hello, Hayabusa, you wrote:

H> Zapostil here since I use class CEvent from ATL.

H> in general all life  such construction, as:

H> [ccode]
H> CEvent m_evStop;

H>//further in the designer
H> m_evStop (FALSE/*init own*/, FALSE/*manual reset*/)


CEvent (

BOOL bInitiallyOwn = FALSE,

BOOL bManualReset = FALSE,

LPCTSTR lpszName = NULL,

LPSECURITY_ATTRIBUTES lpsaAttribute = NULL

);


If I truly understood, you  automatic reset of event (since for   it is necessary to throw the second parameter as TRUE). Further all is simple - event hoists the colors a signal, it is checked by one of flows, and then automatically drops. In the result, the second flow understands that it should continue operation to a following flag (which anybody and is not going to cock).


On idea, the chain should be such:

* To create event with parameters (FALSE, TRUE)

* Something happens

* To install a signal flag

* To wait through join the terminations of flows

* To drop hands a signal flag

3

Re: Stop of two flows one

Hello, Mr. Delphist, you wrote:

MD> On idea, the chain should be such:
MD> * to create event with parameters (FALSE, TRUE)


Logically, I and tried, one of flows why jumps out at once that (what I launch the first) as though  it is installed

Why only one of flows - it is not clear.

4

Re: Stop of two flows one

Hello, Hayabusa, you wrote:

H> Hello, Mr. Delphist, you wrote:

MD>> On idea, the chain should be such:
MD>> * to create event with parameters (FALSE, TRUE)

H> it is logical, I and tried, one of flows why jumps out at once that (what I launch the first) as though  it is installed


Because there are two different CEvent.


One of MFC, with * order of parameters, for it (FALSE, TRUE) will be that is necessary - unstated, manual reset.

Other of ATL, with * order of parameters, for it (FALSE, TRUE) will be that turned out - installed, auto reset.


* "Correctness" concerning corresponding WinAPI .


That is, it is necessary to change parameters in places.


As more far-sighted correction - to write the successor with listings, instead of BOOL' in parameters, already then precisely it does not turn out to be mistaken.

bInitialState it is possible, by the way, and not to stretch parameter in such successor - in advance installed event is necessary hardly is more often, than never.

5

Re: Stop of two flows one

Hello, Alexander G, you wrote:

AG> Because there are two different CEvent.

AG> One of MFC, with * order of parameters, for it (FALSE, TRUE) will be that is necessary  unstated, manual reset.
AG> Other of ATL, with * order of parameters, for it (FALSE, TRUE) will be that turned out  installed, auto reset.

AG> * "correctness" concerning corresponding WinAPI .

AG> That is, it is necessary to change parameters in places.

AG> As more far-sighted correction  to write the successor with listings, instead of BOOL' in parameters, already then precisely it does not turn out to be mistaken.
AG> bInitialState it is possible, by the way, and not to stretch Parameter in such successor  in advance installed event is necessary hardly is more often, than never.


.... Fucking  showed the signature with MFC
smile
Thanks for the help
I of couples also did not guess to transit to look in ATL)

6

Re: Stop of two flows one

Hello, Hayabusa, you wrote:

H> Tvojuzh.... Fucking  showed the signature with MFC
smile
H> Thanks for the help
I of couples also did not guess to transit to look in ATL)


Well, at us two common truths again proved to be true:

1) Assist - angrily

2) MFC - angrily


big_smile

7

Re: Stop of two flows one

Hello, Mr. Delphist, you wrote:

MD> 1) Assist  angrily


I would not tell, in overwhelming majority of time only helps
smile