Re: Event Handle scope.
From: Scott McPhillips [MVP] (scottmcp_at_mvps.org.nothere)
Date: 05/14/04
- Next message: Scott McPhillips [MVP]: "Re: Adding a text area"
- Previous message: Peter: "Re: Adding a text area"
- In reply to: Macca: "Event Handle scope."
- Next in thread: Joseph M. Newcomer: "Re: Event Handle scope."
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 14 May 2004 08:01:06 -0500
Macca wrote:
> I have a thread that uses WaitForMultipleObjects. I have various events and was wondering whether the handles that represent the events (CONST HANDLE *lpHandles in WaitForMultipleObjects Function) need to be declared globally to the dialog class(i.e member variables of the dialog class) so that other functions in the dialog class can set those events. If i declare event handles local to the thread function that contains the WaitForMultipleObjects then all event handling would need to be done in this function. Is that correct or am i missing something?
>
> Cheers
> Macca
If you want to access the handles from the dialog and from the thread
function then they should be declared as member variables of the dialog
class, and initialized before creating the thread. Use the LPVOID
thread parameter to pass a pointer to the thread (such as the dialog's
'this' pointer) so it can access such shared variables.
If the thread also needs to create some private event handles then it
can declare a local array, copy the shared handles into it, and
initialize the local handles in the remainder of the array.
-- Scott McPhillips [VC++ MVP]
- Next message: Scott McPhillips [MVP]: "Re: Adding a text area"
- Previous message: Peter: "Re: Adding a text area"
- In reply to: Macca: "Event Handle scope."
- Next in thread: Joseph M. Newcomer: "Re: Event Handle scope."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|