Click here to Skip to main content
15,915,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Regarding Application.ScreenUpdating() - Draw Graph in Excel Pin
led mike11-Jul-08 5:25
led mike11-Jul-08 5:25 
QuestionEnterCriticalSection() problem on Vista Pin
SRKSHOME11-Jul-08 3:31
SRKSHOME11-Jul-08 3:31 
AnswerRe: EnterCriticalSection() problem on Vista Pin
Mark Salsbery11-Jul-08 5:27
Mark Salsbery11-Jul-08 5:27 
GeneralRe: EnterCriticalSection() problem on Vista Pin
SRKSHOME14-Jul-08 4:58
SRKSHOME14-Jul-08 4:58 
GeneralRe: EnterCriticalSection() problem on Vista Pin
Mark Salsbery14-Jul-08 5:43
Mark Salsbery14-Jul-08 5:43 
GeneralRe: EnterCriticalSection() problem on Vista Pin
SRKSHOME14-Jul-08 19:09
SRKSHOME14-Jul-08 19:09 
GeneralRe: EnterCriticalSection() problem on Vista Pin
Mark Salsbery15-Jul-08 5:36
Mark Salsbery15-Jul-08 5:36 
GeneralRe: EnterCriticalSection() problem on Vista Pin
SRKSHOME17-Jul-08 3:12
SRKSHOME17-Jul-08 3:12 
Hi...
I have checked it again. I don’t think there is any deadlock present. There is no resource as such on which more than 1 threads are waiting.

LockCount - RecursionCount = Number of waiting threads

In my case, Number of waiting threads = 0.

But I found one more interesting thing on vista. WaitForSingleObject() is used here. When I called this function with TIMEOUT=INFINITE. It is not coming out of loop at all. It will be looping there. On Vista WaitForSingleObject() returns 258(I guess it is=WAIT_TIMEOUT). But on XP and lower versions of OS this function returns 0(I guess it is=WAIT_OBJECT_0) and come out of the of the loop.Please see the below code.

bool DSEventSemaphore::WaitForSignal( DWORD TimeOut ) //TimeOut=INFINITE

{
if( State == SemInvalid )
{
return false;
}
DWORD retval;

#ifndef DSTRACEABLE_SIGNAL_STACK /*I haven't defined it. So it wiil not execute.*/
retval = WaitForSingleObject( event, TimeOut );

#else //It will come here
do
{ retval = WaitForSingleObject( event, (TimeOut< DSSLEEP_PERIOD ? TimeOut : DSSLEEP_PERIOD) ); //DSSLEEP_PERIOD=500
if( retval == WAIT_TIMEOUT )
{
if( TimeOut < DSSLEEP_PERIOD )
{
TimeOut = 0;
}
else
if( TimeOut != INFINITE )
{
TimeOut -= DSSLEEP_PERIOD;
}
}
else
{
TimeOut = 0;
}

} while( TimeOut );

#endif

switch (retval)
{
case WAIT_OBJECT_0:
State = SemOK;
return true;

case WAIT_TIMEOUT:
State = SemTimeOut;
Error = GetLastError();
return false;

case WAIT_FAILED:
default:
Error = GetLastError();
State = SemSystemError;
return false;
}
}

Could you please help me.
GeneralRe: EnterCriticalSection() problem on Vista Pin
Mark Salsbery17-Jul-08 5:37
Mark Salsbery17-Jul-08 5:37 
GeneralRe: EnterCriticalSection() problem on Vista Pin
SRKSHOME12-Aug-08 1:05
SRKSHOME12-Aug-08 1:05 
AnswerRe: EnterCriticalSection() problem on Vista Pin
Joe Woodbury11-Jul-08 10:26
professionalJoe Woodbury11-Jul-08 10:26 
GeneralRe: EnterCriticalSection() problem on Vista Pin
SRKSHOME11-Jul-08 23:35
SRKSHOME11-Jul-08 23:35 
GeneralRe: EnterCriticalSection() problem on Vista Pin
Joe Woodbury12-Jul-08 7:07
professionalJoe Woodbury12-Jul-08 7:07 
GeneralRe: EnterCriticalSection() problem on Vista Pin
Stephen Hewitt13-Jul-08 15:29
Stephen Hewitt13-Jul-08 15:29 
GeneralRe: EnterCriticalSection() problem on Vista Pin
Stephen Hewitt13-Jul-08 15:29
Stephen Hewitt13-Jul-08 15:29 
GeneralRe: EnterCriticalSection() problem on Vista Pin
SRKSHOME13-Jul-08 18:52
SRKSHOME13-Jul-08 18:52 
GeneralRe: EnterCriticalSection() problem on Vista Pin
SRKSHOME17-Jul-08 3:15
SRKSHOME17-Jul-08 3:15 
GeneralRe: EnterCriticalSection() problem on Vista Pin
Joe Woodbury17-Jul-08 5:45
professionalJoe Woodbury17-Jul-08 5:45 
QuestionVC ++ help Pin
paresh_sarjani11-Jul-08 3:31
paresh_sarjani11-Jul-08 3:31 
AnswerRe: VC ++ help Pin
Cedric Moonen11-Jul-08 3:56
Cedric Moonen11-Jul-08 3:56 
GeneralRe: VC ++ help Pin
sudhir_Kumar11-Jul-08 19:53
sudhir_Kumar11-Jul-08 19:53 
Questionhow data is managed in CString class? Pin
nisha0000011-Jul-08 3:12
nisha0000011-Jul-08 3:12 
AnswerRe: how data is managed in CString class? Pin
Mark Salsbery11-Jul-08 5:38
Mark Salsbery11-Jul-08 5:38 
QuestionTryEnterCriticalSection() problem Pin
SRKSHOME11-Jul-08 2:42
SRKSHOME11-Jul-08 2:42 
AnswerRe: TryEnterCriticalSection() problem Pin
CPallini11-Jul-08 2:48
mveCPallini11-Jul-08 2:48 

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.