Click here to Skip to main content
15,896,425 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog Always On Top Pin
tjkrz25-Nov-02 10:44
tjkrz25-Nov-02 10:44 
GeneralFile Preview !! Pin
Mash25-Nov-02 8:35
Mash25-Nov-02 8:35 
GeneralSocket TIME_WAIT questions.. Pin
RobJones25-Nov-02 8:32
RobJones25-Nov-02 8:32 
GeneralRe: Socket TIME_WAIT questions.. Pin
valikac25-Nov-02 8:58
valikac25-Nov-02 8:58 
GeneralRe: Socket TIME_WAIT questions.. Pin
RobJones25-Nov-02 9:59
RobJones25-Nov-02 9:59 
GeneralRe: Socket TIME_WAIT questions.. Pin
valikac25-Nov-02 10:57
valikac25-Nov-02 10:57 
GeneralRe: Socket TIME_WAIT questions.. Pin
RobJones25-Nov-02 11:03
RobJones25-Nov-02 11:03 
General,Thread and Mutex Pin
Anonymous25-Nov-02 7:45
Anonymous25-Nov-02 7:45 
Hi everyone,

I have a thread. The function that keeps this thread alive contains a while loop. The while loop is true while a boolean variable is maintained true. When the thread has to terminate, the boolean value is modified to false and the thread dies. This boolean variable is global. I am using a Mutex to control access to this global value.

I would like to know if it is necessary to control global variables with a Mutex when one is just reading the value? Or does one only control the global variable when one is going to modify its value?

This one depends on the previous question. How does one manage something like:
while ( g_bGlobal_Variable )
{
}
How does one apply a mutex object to the above case. Because I cannot do
dwWait = ::WaitForSingleObject();
if ( dwWait == 0 )
{
while ( g_bGlobal_Variable )
{
}
}

Otherwise this implies that the thread always has control over the Mutex object while alive.

Thanks and excuse the ignorance

Regards
GeneralRe: ,Thread and Mutex Pin
Scott H. Settlemier25-Nov-02 8:10
Scott H. Settlemier25-Nov-02 8:10 
GeneralRe: ,Thread and Mutex Pin
Ruca26-Nov-02 1:11
Ruca26-Nov-02 1:11 
GeneralRe: ,Thread and Mutex Pin
Scott H. Settlemier28-Nov-02 16:14
Scott H. Settlemier28-Nov-02 16:14 
General,Thread and Mutex Pin
Anonymous25-Nov-02 7:34
Anonymous25-Nov-02 7:34 
GeneralAnimation Control Pin
Brigg Thorp25-Nov-02 7:28
Brigg Thorp25-Nov-02 7:28 
GeneralRe: Animation Control Pin
Scott H. Settlemier25-Nov-02 10:16
Scott H. Settlemier25-Nov-02 10:16 
GeneralBasic MFC question Pin
will138325-Nov-02 5:54
will138325-Nov-02 5:54 
GeneralRe: Basic MFC question Pin
Rob Caldecott25-Nov-02 5:58
Rob Caldecott25-Nov-02 5:58 
GeneralRe: Basic MFC question Pin
Roman Fadeyev25-Nov-02 6:04
Roman Fadeyev25-Nov-02 6:04 
GeneralRe: Basic MFC question Pin
Stephane Rodriguez.25-Nov-02 6:39
Stephane Rodriguez.25-Nov-02 6:39 
GeneralRe: Basic MFC question Pin
Jeff Patterson26-Nov-02 3:26
Jeff Patterson26-Nov-02 3:26 
GeneralCFileDialog problem under win 98 Pin
lbc25-Nov-02 5:50
lbc25-Nov-02 5:50 
GeneralRe: CFileDialog problem under win 98 Pin
Rob Caldecott25-Nov-02 5:57
Rob Caldecott25-Nov-02 5:57 
GeneralRe: CFileDialog problem under win 98 Pin
lbc25-Nov-02 22:06
lbc25-Nov-02 22:06 
GeneralMDI Splitter problems Pin
Bjornarsen25-Nov-02 5:43
Bjornarsen25-Nov-02 5:43 
GeneralRe: MDI Splitter problems Pin
dima_t25-Nov-02 18:02
dima_t25-Nov-02 18:02 
GeneralRe: Sockets and Threads Pin
georgiek5025-Nov-02 5:34
georgiek5025-Nov-02 5:34 

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.