Click here to Skip to main content
15,921,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: exception and global variable Pin
Maxwell Chen27-Jan-08 23:49
Maxwell Chen27-Jan-08 23:49 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:57
George_George27-Jan-08 23:57 
GeneralRe: exception and global variable Pin
Maxwell Chen28-Jan-08 0:01
Maxwell Chen28-Jan-08 0:01 
GeneralRe: exception and global variable Pin
Rajesh R Subramanian27-Jan-08 23:34
professionalRajesh R Subramanian27-Jan-08 23:34 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:38
George_George27-Jan-08 23:38 
JokeRe: exception and global variable Pin
CPallini27-Jan-08 23:47
mveCPallini27-Jan-08 23:47 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:54
George_George27-Jan-08 23:54 
GeneralRe: exception and global variable Pin
Maxwell Chen27-Jan-08 23:57
Maxwell Chen27-Jan-08 23:57 
GeneralRe: exception and global variable Pin
Cedric Moonen27-Jan-08 23:13
Cedric Moonen27-Jan-08 23:13 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:24
George_George27-Jan-08 23:24 
GeneralRe: exception and global variable Pin
Cedric Moonen27-Jan-08 23:34
Cedric Moonen27-Jan-08 23:34 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:53
George_George27-Jan-08 23:53 
GeneralRe: exception and global variable Pin
Cedric Moonen28-Jan-08 0:05
Cedric Moonen28-Jan-08 0:05 
GeneralRe: exception and global variable Pin
George_George28-Jan-08 0:26
George_George28-Jan-08 0:26 
QuestionRe: exception and global variable Pin
David Crow28-Jan-08 5:08
David Crow28-Jan-08 5:08 
GeneralRe: exception and global variable Pin
George_George28-Jan-08 13:43
George_George28-Jan-08 13:43 
GeneralRe: exception and global variable Pin
David Crow28-Jan-08 15:58
David Crow28-Jan-08 15:58 
QuestionHow to access a single object from multiple thread Pin
Ranojay27-Jan-08 21:57
Ranojay27-Jan-08 21:57 
GeneralRe: How to access a single object from multiple thread Pin
Iain Clarke, Warrior Programmer27-Jan-08 22:02
Iain Clarke, Warrior Programmer27-Jan-08 22:02 
GeneralRe: How to access a single object from multiple thread Pin
Ranojay28-Jan-08 20:20
Ranojay28-Jan-08 20:20 
GeneralRe: How to access a single object from multiple thread Pin
Iain Clarke, Warrior Programmer28-Jan-08 21:50
Iain Clarke, Warrior Programmer28-Jan-08 21:50 
I have *never* had one of those functions giving me an error. The only thing I can think of is that you've not initialised the critical section before using it. Look on
MSDN for EnterCriticalSection. One of the links take you to an example page for critical sections. (Copied below)

I would avoid the use of a global variable, and make the critical section a co-member of a class with your recordset, but I hope you'll get the idea.

Iain.

// Global variable
CRITICAL_SECTION CriticalSection; 

void main()
{
    ...

    // Initialize the critical section one time only.
    InitializeCriticalSection(&CriticalSection); 

    ...

    // Release resources used by the critical section object.
    DeleteCriticalSection(&CriticalSection)
}

DWORD WINAPI ThreadProc( LPVOID lpParameter )
{
    ...

    // Request ownership of the critical section.
    __try 
    {
        EnterCriticalSection(&CriticalSection); 

        // Access the shared resource.
    }
    __finally 
    {
        // Release ownership of the critical section.
        LeaveCriticalSection(&CriticalSection);
    }

    ...

}

GeneralRe: How to access a single object from multiple thread Pin
Ranojay30-Jan-08 20:49
Ranojay30-Jan-08 20:49 
GeneralRe: How to access a single object from multiple thread Pin
Iain Clarke, Warrior Programmer30-Jan-08 21:57
Iain Clarke, Warrior Programmer30-Jan-08 21:57 
GeneralRe: How to access a single object from multiple thread Pin
Ranojay1-Feb-08 22:03
Ranojay1-Feb-08 22:03 
QuestionNetwork detection on windows 98 Pin
Somnath_Mali27-Jan-08 20:36
Somnath_Mali27-Jan-08 20:36 

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.