CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Andrew Truckle Guest

    [RESOLVED] CEvent problem

    I have a CEvent called threadEnd.

    I signal the event to terminate the thread with threadEnd.SetEvent().

    Then, in the thread I want to check that it is signalled. BUT, in some places I only want to see if it is signalled so as to adjust the status text. When the particular loop is finished, then it will check again and close the thread.

    This is due to the interface libraries I am using and must use this method.

    The problem is that when I poll to see if the event is signalled it seems to reset itself. So at the moment I have resorted to a simple global variable.

    Can anyone offer me some help?


  2. #2
    Join Date
    Apr 1999
    Posts
    8

    Re: CEvent problem

    The event is by default automatic, as you have noticed. But you can construct it as a manual-reset event:

    CEvent( BOOL bInitiallyOwn = FALSE, BOOL bManualReset = FALSE, LPCTSTR lpszName = NULL, LPSECURITY_ATTRIBUTES lpsaAttribute = NULL );

    Just set bManualReset to TRUE in the constructor. But this mean that when your loop is finished and you check the event, you must manually reset the event with CEvent::ResetEvent.

    /Michael Grundberg
    M.Sc. Computer Science
    Visionova IT-System, Sweden
    [email protected]


  3. #3
    Andrew Truckle Guest

    Re: CEvent problem

    Hi

    I will look into doing what you said.

    May I ask you what code you would use to check the event?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured