Click here to Skip to main content
15,918,967 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
QuestionRe: Network detection on windows 98 Pin
David Crow28-Jan-08 5:11
David Crow28-Jan-08 5:11 
Question"Show Desktop" windows event? Pin
Somnath_Mali27-Jan-08 20:31
Somnath_Mali27-Jan-08 20:31 
QuestionRe: "Show Desktop" windows event? Pin
David Crow28-Jan-08 5:13
David Crow28-Jan-08 5:13 
Generalhelp [modified] Pin
gentleguy27-Jan-08 20:24
gentleguy27-Jan-08 20:24 
GeneralRe: help Pin
Iain Clarke, Warrior Programmer27-Jan-08 21:49
Iain Clarke, Warrior Programmer27-Jan-08 21:49 
GeneralRe: help Pin
CPallini27-Jan-08 23:26
mveCPallini27-Jan-08 23:26 
GeneralRe: help Pin
gentleguy27-Jan-08 23:55
gentleguy27-Jan-08 23:55 
GeneralRe: help Pin
CPallini28-Jan-08 0:23
mveCPallini28-Jan-08 0:23 
GeneralRe: help Pin
gentleguy28-Jan-08 13:31
gentleguy28-Jan-08 13:31 
GeneralRe: help Pin
CPallini28-Jan-08 21:16
mveCPallini28-Jan-08 21:16 
GeneralRe: help Pin
gentleguy28-Jan-08 23:30
gentleguy28-Jan-08 23:30 
GeneralRe: help Pin
CPallini28-Jan-08 23:42
mveCPallini28-Jan-08 23:42 
Questioncheck box problem Pin
trioum27-Jan-08 19:50
trioum27-Jan-08 19:50 

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.